Emails

Ole Dallerup Updated by Ole Dallerup

How to track your emails

Most companies are sending out emails for marketing, sales and product related information using tools such as Mailchimp, Customer.io, ActiveCampaign or similar. This article will describe how you best ensure to tracking those emails and ensuring the activity gets into your customers journey.

For all cases we recommend that you set up UTM parameters on all links in your emails setting utm_source, utm_medium and utm_campaign as shown in the example.

https://dreamdata.io?utm_source=newsletter&utm_medium=email&utm_campaign=b2b_revenue_attribution

This will give you the basic and ensures that the Dreamdata tracking script can take the UTM parameters and use it for your analytics.

Note: Dreamdata do not recommend doing attribution on either emails send nor open. Its to weak a signal and will generally over attribute emails if you would do that.

Linking to sites without your tracking script

If you in your emails link to sites that does not have your tracking script then the UTMs won't be tracked on you won't see the click in the customer journey. In such cases you have two options:

1. Add tracking script to the website (recommended)

2. Add some redirect tracking

If it's possible it's recommended to add the tracking script on all your commercial websites and landing pages. However it might not be possible, maybe it's not your website at all or maybe the sites does not support you adding custom scripts. Example Dreamdata's status page is a service where customer scripts can't be added.

In such cases you might want to create a small redirect page, where you send users to track them and then afterwards redirect them to the page you intended. Here is an example code we use at Dreamdata for this purpose, example try to click https://dreamdata.io/redirect?url=https://google.com its will send you to Dreamdata, show a Dreamdata logo (and track you) and send you to Google.

The below code assumes you are either using Dreamdata analytics.js or Segment. The scripts waits for the analytics script being ready and when it is redirects the user the the url. At this point in time the tracking script would have fired the page tracking which would have picked up any UTMs, and cookies already on that computer.

window.analytics.ready(function() { 
var getParams = function (url) {
var params = {};
var parser = document.createElement('a');
parser.href = url;
var query = parser.search.substring(1);
var vars = query.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
params[pair[0]] = decodeURIComponent(pair[1]);
}
return params;
};

var params = getParams(window.location.href);
var url = params.url;

if (url) {
window.location.href = url;
}
});

More url parameters

There are also even more advanced cases when you might want to send additional information in the url and identify the users as soon as he or she clicks the link. That is possible if you either have well control over your id's, are ok sending the users email in an url parameter or you might know the users company website.

Example if you parse the users company website in the url parameter ajs_group_website=example.com Dreamdata can without further information associate that users with example.com. In the customer journey the user will show anonymous until under example.com untill the user might identify his/her email.

Here you can read more all supported url parameter here.

How did we do?

Dreamdata Cookies

Google Tag Manager

Contact