Articles in this section

Link Tracking


MessageGears provides users the ability to track clickable links within emails to report on and better understand recipient engagement to mailings. Because of the power of the MessageGears rendering system, there are many different ways that users can input links into emails- which leads to multiple possibilities on how to successfully track and record link clicks. This document will outline various ways users may track links in a mailing, and the reporting outcomes to expect from each method.

Tracking links do not expire, but click activity associated with them is captured and forwarded to the SQS feed for 12 months after a job has been sent. Accelerator's job and campaign analytics pages will continue updating with tracked clicks for 30 days after a job has been sent.


Table of Contents



Dynamic Link Tracking

Context Data Link Tracking

Link Reporting




The most straightforward way to track a link in the MessageGears system is to use the MG ${Gears.track()} macro. By manually wrapping links with this macro, you are informing the system that you would like an individual link to be tracked for attribution and reporting. The macro has three pieces: the link, link name, link ID, and URL append (optional).

While a typical HTML link may be formatted as:

Click <a href="">here</a> to go to our home page.


A link wrapped in $Gears.track() would appear as:

Click <a href=”${Gears.track(‘’,’HomePage’,’1’)}”>here</a> to go to our home page.


This link would direct to the homepage of your website, and would have the ID of 1 and the name of HomePage in your reporting data.

If you do not assign a link ID, then it the ID will default to an ID of -1 for every link without an ID. If you do not assign a link ID and you do not assign a link name in this process, that information will NOT be available in reporting.



Manually marking up each link in a template may be time-consuming, so MessageGears has automated the process of marking up links for you with the Autotrack feature. Autotrack may be turned on for an account, job, or individual link, and automatically tracks any link beginning with either http or www in your template.

Autotrack automatically assigns ID’s to each link in your templates- this information is available in your link reporting. If you would like the link’s name in your reporting, simply mark up the HTML link, as seen here:

Click <a href='' name=’HomePage’>here</a> to go to our home page.

This link would be assigned a link ID, and have the name ‘HomePage’ in your link reporting. Additionally, links can be partially dynamically generated, and still tracked with Autotrack. An example of a trackable link which is partially dynamically generated is:

Click <a href='${Recipient.Product}' name=’ProductPage’>here</a> to go to our Product page.

If you would not like to track specific links in your mailing, you have the option of turning autotrack off for individual links through the HTML, like so:

<a href="" autotrack="false"></a>

This link would NOT be found in your link reporting.


Dynamic Link Tracking

Thus far, the only links being tracked in the template were links which began with http or www and could only be partially personalized. Another common use case is to generate the entire link using freemarker variables, allowing recipients to receive personalized links (possibly from other data sources) after rendering. MessageGears supports this use case through Dynamic Link Tracking, an account-level setting similar to Autotrack which will track all dynamically-generated links.

An example of a dynamically generated link which would be tracked with Dynamic Link Tracking would be the following:

Click <a href='${Recipient.ProductPage}' name=’ProductPage’>here</a> to go to our product page.


If your recipient data included a ‘ProductPage’ variable for each recipient, then each recipient could be sent to a personalized product page, depending on what they had recently purchased. This data could flow from a POS system and could be generated for your recipients in real time. All of these links would have the same link ID and the link name of ‘ProductPage.

If you would like each link for a product to have a separate link ID in reporting, you would need to stitch together conditional FreeMarker to assign each recipient a different link. As an example:

<#if ${recipient.ProductPage} == “Product1”>
<a href='${Recipient.ProductPage1}' name=’ProductPage’>here</a>
<#elseif {$recipient.ProductPage} == “Product2”>
<a href='${Recipient.ProductPage2}' name=’ProductPage’>here</a>
to go to our product page.


All of these links would be given different link ID’s, so giving the link the name ‘ProductPage’, we will be able to group these links together in our link reporting. There are many ways to use FreeMarker to personalize links - see our article on personalizing links for more ways to personalize templates.


Context Data Link Tracking

Oftentimes your Context data may contain links to contextual offer data which you would also like to track. Enabling Context Data Link Tracking will allow you to insert links directly from your context data into the template and have the data tracked in your link reporting. An example of a context link may be:

<#list Specials.Special as special>
<#if special.DepartureCity == recipient.HomeCity>
Product Page: ${special.ProductPage} Fare: ${special.Fare}


Where a section of your context data would be:

<ProductPage><a href=”>Here</a></DepartureCity>


This trackable link would now come directly from your context data, allowing you to contextually insert dynamic offers for this recipient and still contain this information in your link tracking.

The HTML within the Context data MUST be XML-escaped


Link Reporting

MessageGears gives you reporting data in multiple ways, depending on your preference of receiving it:

  • Real-Time Event Feed: MessageGears will, when turned on for your account, place all tracked click events on your click event feed, giving you total access to all data. If you’d like to also have the click event return the ID of the click, please contact client success to enable that feature.
  • Click Heat Map: Your Accelerator instance will report on all link IDs and link names, along with a sample heat map of where in the HTML template your recipients clicked. The URL Id’s are either automatically generated in Autotrack (or assigned by your HTML template creator when sending the mailing) and the names are created by your HTML template editor. Any URL Id’s of “-1” indicate that a link was wrapped in $Gears.track() (see above) and were not assigned a link ID. If this is the case, check your HTML template and either manually assign a link ID and name, or remove the tracking function and enable Autotrack for the job.


Turning On or Off Click Tracking for Individual Links

When you configure the auto-tracking of links in your HTML content, all links will be tracking.  If you wish to turn off tracking of one or more individual links, you would use the following syntax in your content:

<a href="" autotrack="false"></a>

Conversely, you could configure auto-tracking of links to be off by default and you could manually configure individual links to be tracking using the following syntax:

<a href="" autotrack="true"></a>


Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.