Email Tracking

Your marketer sent an email yesterday night:

“I have a new email campaign going out and want to track the performance of these email in terms of how they drive visits and conversion on the website.

My needs are as follows:

  1. I need to know which links users clicked in the email
  2. What did they do on the website
  3. If possible I want a conversion funnel for email journeys
  4. It would be great if you can also tell me how I can get this tracking in place for all my email campaigns going forward.

Sarosh, your friendly colleague in marketing.”

So what now?

Campaign Tracking

Luckily, campaign tracking is a pretty standard thing to do in any analytics package. Adobe Analytics is no exception.

In the web analytics world we call something a “campaign” if it

    1. is off-site (not on our own web site)
    2. has been paid somehow (either directly, per click, per email sent, or because we’re paying someone to tweet)
    3. has links bringing visitors to our site

Campaigns come in all sorts of shapes and sizes. Emails sent out to prospects or customers are campaigns. Our paid keywords on Google or Bing are campaigns. Those banners we’re placing all over the known Internet are campaigns. Even our tweets and Facebook postings are campaigns!

So how do we measure them?

The crucial part is the 3rd item above, the link that brings people to our site. We cannot rely on the HTTP Referer (sic) header, because often people come from apps and there is none.

So, we ask the marketers to assign “campaign IDs” or “tracking codes” to their campaigns. They are supposed to place those tracking codes on every link that they distribute, be it in an email or on twitter.

Now when a visitor clicks on the link, all we have to do is to detect that tracking code in the URL, pull it out and send it into the analytics system.

Let’s look at the details.

Tracking Codes

This is the easy part, from a technical perspective. All the marketers have to do is make sure every link they post or send anywhere in the Internet has a tracking code on it.

Usually, the code would be in a URL parameter named ‘cid’, ‘cmpid’ or ‘extcam’ or something similar. An example link to this posting might look like this:

The tracking code would be “1303selfreflink”.


Some notes:

  • Tracking codes should probably be relatively short. We don’t want to run into the 2048 byte URL length limit on older IEs.
  • A tracking code should be specific, either to the email sent, banner placed or keyword bought, or a level deeper: specific for each link in an email. The more specific it is the more insight the marketer can gain, if they use that data. Don’t worry about having too many tracking codes. There’s a tool called SAINT which will allow you (or your marketer) to aggregate.
  • It makes a lot of sense to agree on a structure for the tracking codes! Coding things like date (“1303”), distribution channel (“eml”, “ppc”, …) or even the name of the person responsible is a good idea! “eml1303jenewmerch01” could be the first link in an email about new merchandise that I sent via email in March 2013. Again, SAINT helps turning those tracking codes into readable campaign names.
  • Use SAINT!

Sending the Code into the Analytics System

Now this is where your skills come into play.

We can do this two ways: a) put JS code on eveyr landing page that looks for the ‘cid’ parameter and reads the code, or b) do it in a central place somewhere.

Once the code has been read from the URL, it needs to go into a special variable that Adobe Analytics provides specifically for campaign tracking: s.campaign.

Being an (ex-) programmer, I definitely prefer option b, of course. We’ll explain how this works exactly, but for now it’s enough to know that you can use a “plugin” in the s_code.js file. The code looks like this:


The first line tries to read the ‘cid’ parameter from the URL.

The second line uses another plugin to deduplicate, meaning if within the current Visit we have seen this tracking code, we won’t send it into the analytics system again. Most marketers prefer it this way.

We won’t go into the difference between “traffic variables” and “conversion variables” at this point, but just so you know: s.campaign is a conversion variable, a bit like a persistent tag tied to the visitor.

With the tracking code sent into Adobe Analytics, the marketer can now answer all the questions they raised in their email above. They can segment by a tracking code or a campaign. They can look at funnels based on the campaign, and they can even find out which link worked best if they assigned individual tracking codes to all the links in the email.

Next week we’ll post a series of articles about the s_code.js file.


German expat living in Switzerland (formerly UK and France). Consultant and member of the Multi-Solutions Group at Adobe, working with the Digital Marketing Suite. Father of 4 girls.

Tagged with: , ,
Posted in Javascript, Principles
20 comments on “Email Tracking
  1. […] have already mentioned tracking codes and campaign tracking, where we basically capture a tracking code off the URL and place it into the s.campaign variable. […]


  2. […] Say you just made a change to your s_code.js file. From now on, your site is supposed to pick up the “fb_ref” parameter for links coming from Facebook and put the value into s.campaign. […]


  3. […] Our colleagues in Engineering Services have created a tool called SAINT Bernard that partly automates the process of creating and uploading classifications for campaign tracking. […]


  4. […] ever need very specific data, like a log of hit-level data or maybe a report specific to one single email campaign or even a single visitor? What if someone at Adobe wants to look at what data was actually received […]


  5. […] can subrelate products and campaigns to see click-through and conversion rate for her […]


  6. […] things people do to other things people do later. This is what allows your friendly marketer to track email campaigns for […]


  7. […] code basically aborts all tracking unless there is a campaign tracking code or at least an event […]


  8. […] case 4 — marketing: use an extra eVar to capture tracking codes and you can build a dashboard that allows you to watch campaign results in real time. You can pass […]


  9. […] Your friendly marketer will be able to use that in all sorts of reports, e.g. broken down by her campaigns or maybe by products. In the Newspaper industry, she could break those numbers down by site section […]


  10. […] you want to test Campaign tracking, maybe with live campaigns or paid […]


  11. […] look at campaign tracking because that is where the marketing money goes and your friendly marketer want’s to know […]


  12. […] Campaigns — you likely set it up so your implementation tracks at a fairly granular level, usually the […]


  13. […] tell a marketer to start with very small steps, like for example Campaign Tracking. Once they have mastered that step — meaning it has been implemented, it collects data and the […]


  14. […] the basic principle of Campaign tracking, you capture which post brought visitors to the site at the time when they land. You store that in […]


  15. […] long, but there is one more thing I need to explain: Mobile App Acquisitions, the mobile way to do Campaign Tracking. This is very important to your […]


  16. […] eVars. The example with the shop and the stamps works really well with people who know what a marketing campaign is and why you should track it, but it is totally meaningless for a developer who wants to learn […]


  17. […] Zkusil jsem uvést příklad, kdy a proč značkujeme návštěvníky dle toho, z jaké marketingové kampaně do měřené aplikace přicházejí. Pro vývojáře to ale nebylo příliš užitečné. Ten se […]


  18. […] if she sends out all her emails with tracking codes that all start with “em-“, then she can automatically classify all tracking codes that […]


  19. […] who ever pays for traffic should be using campaign tracking! How else will you ever find out whether you spend your money […]


  20. […] (as in: pre-DTM), we used it to put Javascript that would grab campaign tracking codes from URLs, call plugins, or do other useful things. Anything that would potentially apply to all […]


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 1,398 other followers

%d bloggers like this: