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

ACC only recognizes the static link: Adobe Campaign tracking links prerequisites showing static vs targetData links

Let’s fix it!

Step 1/2: href must start with https://

  • Prefix <%= targetData with https://
  • Remove https:// (or http://) in the targetData.link with the regex .replace(/^https?:\/\//, '') Fix tracking links by prefixing targetData URL with https protocol in Adobe Campaign

Step 2/2: Tracking formula for UTM codes

  • The tracking link formula doesn’t work with targetData: Adobe Campaign tracking formula failing with targetData links showing empty result

  • This is because by default the formula has a condition on $(urlstring): Default Adobe Campaign tracking formula code with urlstring condition

  • 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\.myrosblog\.com|targetData)/i;
if( $(urlstring).match(pattern) ){
%>
&utm_source=newsletter&utm_medium=email&utm_campaign=<%= message.delivery.internalName %>
<% } %>

Fixed Adobe Campaign tracking formula with targetData pattern for UTM codes

  • Which results in a targetData link tracked with UTM via the delivery formula: Adobe Campaign targetData link now tracked with UTM parameters after formula fix