This article will walk you through the settings and how to use placeholders and segment splits in Journeys using DataDocs.
Basics
When you want to use DataDocs in Journeys or Campaign Manager you need to point out the documents you want to use for the flow at the start. The targeted documents for each contact will be available for placeholders (to render content) throughout the flow *.
Please note that filtering of documents only is available in Journeys and Campaign Manager.
For starters triggered by the API, you must include the documents in your call.
For all starters run by a segment, you will target the documents on DataDocs filter.
Important! The starter segment will target your specific contacts and the DataDocs filter will fetch all your filtered documents and store these for each contact for your whole flow.
You can choose to also include your filter conditions to your starter segment but be aware of that all conditions in your filter in that case must match a contact. I.e. depending on your flow, you might need to build one segment that includes DataDocs and mirror these in the filter.
Placeholders
To render data you will refer to documents:
{{#documents}} Welcome to {{event}}! {{/documents}}
Every document that is pointed out by the filter in the starter will be rendered, i.e. if two documents are found, above would render:
Welcome to Mongoose FC - Pumba FC
Welcome to Circus Salsa
If your document filter targets multiple documents but you only want to print out the first or last added document for a contact you can use
- {{#if @first}}
- {{#if @last}}
{{#documents}}{{#if @last}}Your level={{level}}{{/if}}{{/documents}}
You can also target documents by different values by using the helper #when:
{{#documents}} {{#when points ">=" 1}}{{#when points "<=" 250}}Membership: SILVER{{/when}}{{/when}} {{#when points ">" 250}}{{#when points "<=" 500}}Membership: GOLD{{/when}}{{/when}} {{/documents}}
If your filter is pointing out documents from different document types and you want to render these differently you can specify different content by the type id:
{{#documents typeId="38"}}Welcome to {{event}}{{/documents}} {{#documents typeId="39"}}Your support ticket #{{ticketId}} is {{ticket.status}}.{{/documents}}
Welcome to Mongoose FC - Pumba FC
Your support ticket #ABC-123 is in progress.
The filtered documents will be rendered as they were when entering the flow, even if the documents have been updated.
If you, later on, may have updated the documents and want to render the updated version, you use the helper snapshot="CURRENT":
{{#documents snapshot="CURRENT"}} Your issue #{{tickedId}} is {{ticket.status}}. {{/documents}}
Your support ticket ABC-123 is solved.
To render data in an JSON object, you simply write the entity_name.attribute_name, for example:
{{event_details.location}}
You can of course transform your data using handlebar helpers:
{{date "MMMM d" event_date}}
Segment splits
If a contact has entered a flow with data that has been updated during the trip, the handlebars will still show the entering data (if not stated otherwise). However, segment splits will always evaluate the conditions based on the current data. This means that you can set up segments splits to determine the rest of the flow based on your updated data.
Example journey
This journey will send some emails before a sporting event.
The starter segment targets all contacts who should enter the journey.
The DataDocs filter on the starter stores all documents where the event date is seven days from now and has category "sport" (for all contacts matching the starter criteria):
If a contact has multiple documents matching the condition, all documents will follow the contact in the journey.
The first email in the journey will include some general information about the event:
On the event day we have set up a final reminder. At this point we want to make sure that any updates to an event are displayed, meaning we do not want to render the document as it was when entering the flow.
Therefore we update the placeholder and say it should fetch the document as it looks right now (using "snapshot="CURRENT"):
{{documents snapshot="CURRENT"}}
It is time for {{event}}....
{{/documents}}
If any of the values has been updated since entering the flow, say the start time of the event has been moved 1 hour, the current values will now be rendered.
* Since the specific documents for each contact already are fetched by the starter, no content segment is needed for rendering the correct data. If you are used to working with content segmentation and placeholders for Purchase history, this is a game changer.