Outputs and data objects


Objects are the different types of data you have access to when using advanced personalisation. The following objects are supported: 

Contact data

This object provides you access to your contacts standard data fields and other system-defined data fields within your account. 

Contact data fields

These are started with contact.data followed by the data field name e.g.

{{ contact.data.firstname }}
{{ contact.data.gender }}

This would be an exact replication of the current @FIRSTNAME@ and @GENDER@ personalisation.

Each datafield will output data according to its type which could be:

  • Text
  • Dates
  • Numerics (outputted as decimals)
  • Boolean

See the documentation on filters for how to manipulate each of these types.

Contact behaviour

Last open date and last mailed date can be accessed using the outputs:

{{ contact.behavior.lastmailed }}
{{ contact.behavior.lastopened }}

Each of these output a date and time based on the most recent activity for a contact; these can then be manipulated using date filters.

Address books and segments

This object allows you to see the segments and address books that a contact belongs to. This typically will be used in content logic to decide what contact a user receives. When used the segment / address book ID and Name is returned and using a map filter you can decide which value you want your logic to be based on. This object name is:

{% for book in contact.addressbooks %}
{{ book }}<br/>
{% endfor %}

This will output an array of address book/segment objects such as:

{"ID":"1209228","Name":"Newsletter subscribers"},
{"ID":"1211594","Name":"Opened in last 30 days"},
{"ID":"3054221","Name":"Clicked in last 30 days"}

Each containing the ID and name of the address book / segment.

Contact scoring

If you have contact scoring enabled on your account, we also provide an object for you to either output these scores or use them within content logic. The currently available objects are and output an integer value:

{{ contact.scoring.suitability }}
{{ contact.scoring.engagement }}
{{ contact.scoring.score }}

Insight data

If you have one of our Insight features enabled on your account or your importing your own custom data this is now accessible via advanced personalisation, this can be used again either for personalisation or content logic. This object begins with contact.insight followed by the collection name; for example:

{{ contact.insight.OrderInsight }}

Will return an array of all records for a contact in the collection OrderInsight.

These will typically be referenced in a for loop, for example:

{% for order in contact.insight.OrderInsight %}
{{ order.QuoteID }} <br/>
{% endfor %}

(See our cheat sheet on using logic tags for more information on for loops.)

You can also reference directly by their position in the array, for example:

{{ contact.insight.Webinsights[0].ip_address }}

Will return the value of "ip_address" in the first record for the contact in the Webinsights collection.

Contact ID

The contact ID can be accessed using the output:

{{ contact.id }}

Contact preferences

If you're making use of marketing preferences, they can be typically accessed in a for loop, like so: 

{% for pref in contact.preferences %}
{{ pref | json }}<br>
{% endfor %}

This will output an array of preference objects such as:

"privatename":"My preference without a category",
"publicname":"My preference without a category",
"datecreated":"01/11/2018 11:16:52",
"datemodified":"01/11/2018 11:16:52",
"preferences": []
"privatename":"My category",
"publicname":"My category",
"datecreated":"01/11/2018 11:16:52",
"datemodified":"01/11/2018 11:16:52",
"privatename":"My preference inside a category",
"publicname":"My preference inside a category",
"datecreated":"01/11/2018 11:16:52",
"datemodified":"01/11/2018 11:16:52",
"preferences": []

Campaign name and ID

The campaign name and ID can be accessed using the outputs:

{{ campaign.name }}
{{ campaign.id }}

Account info

Currently this object returns only a single value however something most account will find valuable and that is the date/time of the account at the time of send. Using date filters you can then customize the display of this information how you wish. This object is: 

{{ account.datetime }}
{{ account.date }}

AccountInsight data

If you have the ability to store account insight data within your account, this information can also be used for either personalisation or content logic. Following the same rules of contact insight this object begins with account.insight followed by the collection name and value from the collection you want.

An example of this could be your storing products within your account, for example:

{{ account.insight.Products }}

Will return an array of documents in the Products collection:

{{ account.insight.Products[0] }}

Will return the first product in the collection.

{{ account.insight.Products[0].name }}

Will return the name of the first product in the collection.

Did you find this article helpful?

Can we help?

Thanks for using Dotdigital. If you need more help or support, then contact our support team.