By using the rule type DataDocs you can target contacts based on their relational data documents. This could be purchase or behavior history, upcoming events or any other data that you have imported to DataDocs.
To create a segment matching DataDocs, click on the + (plus) icon and select DataDocs in the add-pop up.
You must then select the DocType you want to use for your condition.
If you have a added JSON schema for your selected DocType, you can select your different headers in a dropdown and they will be prepared with correct attribute type (text/date/number). If not, you will need to write them manually and select the attribute type.
In this example, all contacts with documents found in the DocType EVENTS with the category "sport" and with an event_date "tomorrow" will be targeted.
You can also select how many documents that a contact should have with the criteria to match the segment:
To target contacts that have not bought anything within a category you can use Number of documents and match exactly 0 (documents):
Aggregated conditions
Aggregated conditions allows you to set up calculations for number values in the matching documents.
For example, this segment targets all contacts with documents matching a purchase with the transaction date from yesterday where the product category is shoes.
The matching documents are then being checked if they together have a total cost of at least 500:
To add an aggregated condition, click on Show more and then the dropdown to open:
Select your aggregation type, the attribute to calculate and the target numbers.
You can select the following aggregations:
- Average = the average value of all matched documents
- Sum = the total value of all matched documents
- Count = the amount of document rows
- Minimum = the smallest value of all matched documents
- Maximum = the biggest value of all matched documents
The targeted numbers can be:
- exactly (your entered value)
- at least (your entered value)
- at most (your entered value)
- between (your entered values)
Targeting data in document arrays
Documents including data in arrays can be used for segmentation.
Select your array attribute in the dropdown and click Edit array conditions to open the array editing modal.
The options for editing an array is the same as for editing regular attributes.
When using Aggregated conditions the values for all matching items within the array will counted.
In below example matching contacts would need at least one item in the array holding productName equals lily and price is more than 20. Also (all together) the matching item(s) must have at least a quantity of 3.
Please note! If you can't find any array attributes in your attribute drop down, your schema probably needs to be updated to map the array. Learn more.