How to track your HTML links in an Adobe Campaign delivery when they are generated from upstream data targetData
?
ππβοΈ
Step 0: Prerequisites
- Campaign with a Query, an Enrichment with
customUrl
field and an Email delivery:- With a static link
<a href="https://blog...">
- With a targetData link
<a href="<%= targetData.customUrl %>">
- βDisplay URLsβ checked
- With a static link
ACC only recognizes the static link:
Letβs fix it!
Step 1/2: href
must start with https://
- Prefix
<%= targetData
withhttps://
- Remove https:// (or http://) in the
targetData.link
with the regex.replace(/^https?:\/\//, '')
Step 2/2: Tracking formula for UTM codes
-
The tracking link formula doesnβt work with targetData:
-
This is because by default the formula has a condition on
$(urlstring)
: - And the formula is executed BEFORE targetData is replaced by its content!
- The condition regex must contain a
OR targetData
:<%@ include option='NmsTracking_ClickFormula' %> <% var pattern = /(blog\.floriancourgey\.com|targetData)/i; if( $(urlstring).match(pattern) ){ %> &utm_source=newsletter&utm_medium=email&utm_campaign=<%= message.delivery.internalName %> <% } %>
- Which results in a targetData link tracked with UTM via the delivery formula: