Outputs and data objects

Objects are the different types of data you have access to when using Liquid.

Gareth Burroughes avatar
Written by Gareth Burroughes
Updated over a week ago

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, for example:

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

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

Each datafield outputs data according to its type, which could be:

  • Text

  • Dates

  • Numerics (outputted as decimals)

  • Boolean

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.

Lists and segments

You can still use the data object contact.addressbooks. This object also refers to Lists. Address books was the previous name for Lists in Dotdigital.

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

{% for list in contact.lists %}####{{ list }}<br/>{% endfor %}

This outputs an array of list or 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 list or 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 as follows, 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 you're importing your own custom data, this is accessible through Liquid, and can be used either for personalisation or content logic. This object begins with contact.insight followed by the collection name, for example:

####{{ contact.insight.OrderInsight }}

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

These are typically referenced in a for loop, for example:

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

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

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

returns 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 this:

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

This outputs 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",
"ispreference": "true",
"ispublic": "true",
"listid": "12345",
"optedin": "true",
"preferences": []
},
{
"privatename": "My category",
"publicname": "My category",
"datecreated": "01/11/2018 11:16:52",
"datemodified": "01/11/2018 11:16:52",
"ispreference": "false",
"ispublic": "false",
"listid": "",
"optedin": "false",
"preferences": [
{
"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",
"ispreference": "true",
"ispublic": "true",
"listid": "98765",
"optedin": "true",
"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 accounts may valuable is the date/time of the account at the time of send. Using date filters you can customise the display of this information how you want. 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:

####{{ account.insight.Products }}

returns an array of documents in the Products collection.

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

returns the first product in the collection.

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

returns the name of the first product in the collection.

Did this answer your question?