Mark Everard

Hello, I'm Mark – a PhD physicist turned technologist / architect.

Archive for the ‘Email’ Category

Adding GA tracking to Emails delivered using Adobe Campaign

with one comment

Adobe Campaign contains a formula that is executed in the delivery preparation phase which parses a delivery template and modifies all links, so that they are passed through a tracking server. This allows links to be individually tracked to a both an email recipient and a specific delivery.

A link to the BBC news site, is changed to https://t.adobe-campaign.server/r/?id=hcc970,436a07,436a08. The latter url eventually resolves to BBC news, but first is passed through the tracking server, that issues a redirect and records that the link has been followed.

Google Analytics Tracking

Google Analytics can track inbound links to a site and attribute them to a source and an associated campaign. It does this in a number of ways, either via cookies, or for cross-domain links by checking querystring parameters. The following parameters are recognised

  • utm_content
  • utm_source
  • utm_medium

See the following link for further information about each parameter and the ‘meaning’ –

Modifying the Click Tracking Formula

The click tracking formula in Adobe Campaign can be modified to include additional query string parameters within the forwarding record. This is achieved by modifying the NmsTracking_ClickFormula contained in Administration > Platform > Options

You should very carefully test the click tracking formula after making any modifications. Be very sure that the record you enter doesn’t include any spurious white space or line-breaks. Adobe Campaign is very ‘fussy’ about character encoding! As an example, when I first modified the below we discovered that modified outbound links were rendering incorrectly in Hotmail / email clients.

Links within the rendered email body had a line break before and after the URL which Hotmail interpreted as a link without a protocol and so added an additional protocol to the start of the url, so our links looked like https://https://t.adobe-campaign.server/r/?id=hcc970,436a07,436a08 . I’m sure this type of functionality is intentional from Hotmail / Outlook so they can turn entries in text into a fully-formed hyperlink. Regardless, it does show the complexity and why its vital to test your deliveries in a tool like Litmus – test email rendering.

Be very careful about cutting and pasting this as I’ve deliberately added line-breaks and white space to make it readable!

<% if( typeof strPurlTrackingServer!="undefined" && strPurlTrackingServer.toString() ) { %>
<%= strPurlTrackingServer %>
<% } else { %>

<%@ include option='NmsTracking_ServerUrl' %><% } %>/r/?id=<%= type.substr(0, 1) + (<0 ? ( : %>,
<%@ value object="delivery" xpath="@idTracking" %>,<%= escapeUrl("$(urlId)") %>&utm_campaign=<%= variables.utm_content%>&utm_medium=email&utm_source=adobe_campaign
if (document.mode == "forward")
 var d = message.getParameter("d")
 if( d )
 d = d.split(",")
&ap_visitorId=<%=message.getParameter("visitorId") != '' ? message.getParameter("visitorId"):0 %>&ap_category=<%= d[0]?d[0]:'' %>&ap_deliveryId=<%=d[1]?parseInt(d[1],16):0%><%
} %>
if( typeof proposition != "undefined" && proposition.length == undefined )
{ %>&ap_oid=<%= %>
<% } %>

The utm_medium and utm_source variables are hardcoded to be ’email’ and ‘adobecampaign’. These parameters are used by marketing analysts to understand the channel and source system that a visit can be attributed to.

Adding a variable to a delivery template

The above tracking formula depends on the delivery template having a variable named utm_content added into its context. If a template does not have this variable defined then the delivery will fail at the html compilation stage, and that’s always a pain to debug!

A good practise is to have the variable’s value taken from the internal delivery Id. This means your Google Analytics will be able to easily identify inbound links coming from specific emails sent from Adobe Campaign. It’s straightforward to set this within the delivery template as shown below.



Written by mark

October 8th, 2015 at 10:00 am