Setting the tracking code merge and find strategies
When you send a person's data for user session association using the ap3.track
method, you can set the merge strategy and find strategy. Learn about each below.
In addition to the information provided in this article, you may wish to read about tracking code merge keys and using a custom field as a merge key.
Set the merge strategy
The merge strategy determines how a person’s existing field values are merged. There are two available merge strategies for the tracking code:
- “Append only” (
true
) – Using this strategy, all fields with existing values in Ortto’s CDP are not changed. Ortto only adds new data (for fields without a value). - “Ignore” (
false
) – Using this strategy, no updates are applied to the existing person’s record in Ortto’s CDP, but a new person will be created if it doesn’t exist.
Learn more about merge strategies.
The merge strategy can be set when you send a payload of contact data using the ap3c.track
method. If not set, the default merge strategy is: Ignore.
To set the merge strategy, add the key “cc”
: and true
/false
to your ap3c.track
payload.
For example, to set the strategy to “Append only”, you send:
ap3c.track ({ “cc”: true, ac: [{ “fi”: “str:cm:customer-id”, “v”:“<value>” }]})
Below are illustrations demonstrating how each of the merge strategies ingest data, in addition to the available find strategies. To view a larger version of each image, open it in a new browser tab.
Set the find strategy
A data source’s find strategy (also referred to as a merge key strategy) tells Ortto how you want to match data source contact records with existing records in your CDP using merge keys (identifiers).
In the case of the tracking code, the find strategy tells Ortto how to associate a session with a known user.
The find strategies are:
For the tracking code, when calling the ap3c.track
method with a payload of contact (user) data, you can specify the find strategy. To do so, use the key "fs"
with a value of:
0
– Merge with any key match. Or1
– Match only if previous merge key is empty.
NOTE: If no find strategy is set, the default strategy is 0
(merge with any key match).
When looking to match the tracked user data against your existing CDP records, the tracking code data source will assess the inbound user data using the following merge keys, in order of priority: push registration ID, external ID, <primary unique identifier>, <fallback identifier>, email, phone, <custom fields>
.
Merge with any key match
If you set “fs: 0”
, Ortto will look at the user data provided in the ap3c.track
payload to see if a match can be found for an existing contact in your CDP. For example, a payload like:
ap3c.track({"v":0,"email":"user@emaildomain.com",ac: [{"fi": "str:cm:custom-id", "v": "value"}]});
Ortto will look at the email
and ac
(custom field) merge keys (according to the priority order described above) to find a match. If a match is found, the session will be associated with an existing contact. If no match is found, a new contact will be created and associated with the session. Depending on your merge strategy, data supplied for empty fields will be populated (append only) or not (ignore).
The same applies if you have set a custom field as a merge key – the custom field will be added to the list of identifiers that Ortto will check for a match.
Match only if previous merge key is empty
If you set “fs: 1”
, Ortto will look at the identifiers sent in the ap3c.track
payload to find a match to an existing contact in your CDP using the first and highest priority merge key (e.g. email
). If we can’t find a match on the first key but can by the second key, we check if the first key is present on an existing contact which matched the second key. If yes, we skip that contact and create a new one.
This means that if you provide the following payload: ap3c.track({"email":"user@emaildomain.com", ac: [{"fi": "str:cm:custom-id", "v": "value"}]})
Ortto will look at your CDP for a match based on the email
and:
- If a match is found for the
email
, then we will associate the session with that contact. - If no match is found on
email
, we will look for a match based on the next merge key:ac
(custom field).- If the custom field matches and the
email
is empty, we will associate the session with that contact. - If the custom field matches but the
email
has a different value, a new contact will be created based on the custom field (and will be associated with the session).
Depending on your merge strategy, data supplied for empty fields will be populated (append only) or not (ignore).