Outputs and data objects

Summary

Objects are the different types of data you have access to when using dynamic personalisation. Currently 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:

{{ contact.addressbooks }}

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.WebInsight[0].ip_address }}

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

Contact ID

The contact ID can be accessed using the output:

{{ contact.id }}

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.

Have more questions? Submit a request

Comments

  • Avatar

    Is there any way to access account/contact Insight data by key directly, instead of using an array? All of my products have an ID and that is the key for each entry and I'd like to use that directly in content logic.

  • Avatar
    Edited by Felipe Santiago
Powered by Zendesk