ResourcesKnowledge Base

Advanced tracking

Mailkit provides you with an in-depth tracking of your email campaigns but it’s very important to tie the email campaign reporting to website tracking. Whether you are using Google Analytics, Google Analytics 360, Adobe Analytics (formerly Omniture), Heap, Mixpanel, Amplitude Analytics or any other platform, Mailkit allows you to pass tracking information to these 3rd party systems and your website in general.

Generally the 3rd party tracking is done by passing identification information in the link to the website, also known as UTM parameters. The website analytics platform or any 3rd party system then uses the information passed in the URL to identify the referer (source) of the visit and further visitor tracking and reporting. For example, the following link allows 3rd party tracking to identify the traffic to example.com that came from a particular email newsletter, as part of a particular campaign:

https://example.com/?utm_source=news4&utm_medium=email&utm_campaign=newsletter

It would be highly inefficient to embed all of this information directly in your campaign links as it would require a considerable amount. Imagine doing this on a scale for brands that send out multiple campaigns every day/week in different countries. The task of managing the URLs would become even more complicated if you consider the need for personalized information about the visitor.

To automate this process Mailkit offers an easy to use option in campaign settings that is enabled by default and is controlled by the “Enable 3rd party link tracking” setting.

analytics tracking

Underneath you have the option to select your Tracking tagset and enter the Name for analytics. The Name for analytics can be a simple text name or it could be a variable retrieved from a datasource. Templating conditions are not allowed in this field only a direct reference to a variable.

You can select System default tagset, Account default tagset, or one of your custom tagsets. The system default tagset format of UTM parameters is preset in the following way:

https://www.example.com/?utm_source=[ID_MAILINGLIST]-[MAILINGLIST_NAME]&utm_medium=[CHANNEL]&utm_term=[ID_SEND_MESSAGE]&utm_content=[LINK_CONTENT]&utm_campaign=[GA_NAME]-[CAMPAIGN_VARIANT]-[YEAR][MONTH][DAY]

It may look complicated but there is a simple logic behind this structure:

utm_source - provides the information about the source of your data - the ID of your list and it’s name
utm_medium - carries the information about the delivery channel used - email, sms, app_push, etc
utm_term - holds the unique identifier of the recipient who clicked the link. This is a critical information if your website or a 3rd party system needs to get detailed information about the recipient through our API.
utm_content - identifies the content in the message that was clicked. For links in text it will hold the text of the link, for images the name of the image or the information provided in the alt/title. Mailkit always tries to use the best human readable value of the link.
utm_campaign - as the name suggests this it the name of your campaign. This is automatically derived from the campaign name but can be set in the campaign advanced settings under “Name for analytics” for better control. The campaign name is supplemented by its variant (A/B testing) and year, month and day of the campaign send.

But don’t stop there - this is just our system default… unless you create your Link tracking tagsets. And it doesn’t have to follow our template at all - it could be pretty much anything you need for your analytics platform or your website.

Setting up custom tracking

The first step is to setup your custom link tracking tagsets. This can be done in Profile/Integration where you will find the block that holds the existing tagsets and allows you to manipulate them and select your default. At minimum you will see the “System default” tagset which uses the above mentioned structure of parameters.

link tracking

The first column marks the default tagset, followed by its name that you can select in the campaign settings. In the third column you can see the actual structure of the link tracking parameters and the last column has the related actions - set as default, edit and delete.

edit tagsetStart setting up your new tagset by clicking the “Add tagset” button which will present you with a dialog. Enter the desired name of your tagset and start typing the required URL parameters. 

The tracking parameters are usually separated by the “&” character, but some analytics platforms use “:” as separator. Consult your analytics platform guide on proper structure.

The input field will automatically suggest the common parameters as well as the values that can be used. Anything you enter here will be added to the tracking link - whether you enter text or value placeholders. 

The tagging placeholders are replaced by actual data for each recipient/campaign delivery. The full list of placeholder tags is following:

[ID_MAILINGLIST] - ID of the mailing list used for campaign delivery. In case of multiple lists used the first one from which the recipient of the message originated is used.
[MAILINGLIST_NAME] - name of the mailing list used form campaign delivery. In case of multiple lists used the first one from which the recipient of the message originated is used.
[ID_SEND_MESSAGE] - unique ID of the sent message. The value can be used to lookup specific recipient using API mailkit.email.getstatus to get recipient data
[LINK_CONTENT] - content of the link clicked - the text of the link or name of the image on which the link was located.
[LINK_TITLE] - title of the link from the data-link-title attribute of the element. This attribute can be used to add custom titles at the link level and give your link position a title displayed in the reports. The data-link-title value can not be variable as only one title can be set per position.
[LINK_TRACK] - tracking name specified in data-link-track attribute of the element. This attribute can be used to pass additional recipient variables (eg. from template) for each individual recipient in the URL.
[ID_RECIPIENT] - ID of the recipient - a unique identifier of an email address across the system
[EMAIL_MD5] - an MD5 of the recipient email address converted to lower-case. This can be used to pass recipient email in a secure way to trusted 3rd party
[FIRST_NAME] - recipient’s first name
[LAST_NAME] - recipient’s last name
[NICK_NAME] - recipient’s nickname
[GENDER] - recipient’s gender
[CUSTOMx] - recipient’s custom field x, where x could by any of 1-25.
[ENG_SCORE] - recipient’s engagement score at the time of click
[GA_NAME] - campaign’s name for analytics
[CHANNEL] - campaign delivery channel
[CAMPAIGN_NAME] - campaign name
[CAMPAIGN_NAME_LC] - lower-case variant of campaign name
[CAMPAIGN_VARIANT] - campaign variant if A/B testing is used
[YEAR] - year the campaign was sent (eg. 2019)
[MONTH] - month the campaign was sent (eg. 02)
[DAY] - day the campaign was sent (eg. 05)
[WEEK] - week the campaign was sent
[DAYOFWEEK] - day of week the campaign was sent (1-7)
[DAYOFYEAR] - day of year the campaign was sent (1-365)
[HOUR] - hour the campaign was sent (0-23)
[MIN] - minute the campaign was sent (0-59)
[SEC] - second the campaign was sent (0-59)
[SYEAR] - short version of year the campaign was sent (19 instead of 2019)
[SMONTH] - short version of month the campaign was sent (2 instead of 02)
[SDAY] - short version of day the campaign was sent (5 instead of 05)

WARNING: For security reasons the email address is NOT directly exposed. While it’s possible to pass the recipient email to a LINK_TRACK variable this is highly discouraged as this is a MAJOR security issue as it would be transferred insecurely over the network in the URL. Avoid having links on recipient’s email or passing recipient’s email intentionally in the link tracking parameters.

In addition to data-link-title and data-link-track there is a data-link-group attribute that is not exposed to the tagging but is used internally to group related links. For example if you have a product block in your email with links to the product placed on the title, image and CTA button, you can add the data-link-group attribute with the same value (eg. product name) to each of these links and have them grouped in the reports. This can be used throughout your campaign to group related links, eg. all social network links, all menu links, etc. giving you a different view of the links in your reports.

There are cases when link tagging or link tracking is not needed. The tagging can be disabled by adding an attribute mkt-notag="true". If you choose to disable tracking using mkt-notrack="true" both tracking and tagging will be disabled. 

While there are no limitations to what you choose to have in the URL it must follow some simple rules on formatting. The pattern can’t start with characters ? or & as these are automatically added by the system depending on the URL itself. If you need to pass reserved characters like ?, &, /, #, etc. that are reserved as parameter separators or non-ascii characters in content they must be URI encoded (eg. %3F instead of ?, %26 instead of &).

How about my own UTM parameters?

If your campaign or template has it's own UTM parameters defined you have to make sure to disable 3rd party link tracking as it would override the UTM parameters in your links. But why would you bother setting it up in the campaigns or templates when you can take advantage of the automated link tracking.