Setup custom tracking for email links in DTM




I need help setting up all emailing links for all exhibitions extended by following GET variables: uid, mh, exn, mn, ct. For example, link might looks like: utm_source=recommend&utm_medium=27112018&utm_campaign=reedclick&uid=001&e xn=002&mn=003&mh=3258720dd4c1bb28d808fb4ac79b7a3e&ct=uchastnik

The purpose of this is to help setup custom tracking for this links on all Reed Exhibition Russian websites with DTM installed. Value of these variables should be pushed into Google Analytics using methods described below. Highly important to check length of value for each variable before sending it, otherwise empty values might be sent.

It should be at least 1. It’s also important to make sure ‘set’ method called before ‘send’, otherwise it wont be captured by Google Analytics.

1) For «uid» and «mh» variables following code should be fired: Where {uid} and {mh} - values of «uid» and «mh» GET variables. It’s highly important to send these variables first into Google Analytics.

2) For «exn», «mn» and «ct» variables following code should be fired: Where {exn}, {mn} and {ct} - values of relevant GET variables. For instance, if someone click on a link above this code will be executed: ga('set', 'dimension1', {uid}); ga('set', 'dimension2', {mh}); ga('send', 'event', 'email_tracking', 'exhibition_id', {exn}); ga('send', 'event', 'email_tracking', 'mailing_id', {mn}); ga('send', 'event', 'email_tracking', 'click_type', {ct}); ga('set', 'dimension1', '001'); ga('set', 'dimension2', '3258720dd4c1bb28d808fb4ac79b7a3e'); ga('send', 'event', 'email_tracking', 'exhibition_id', '002'); ga('send', 'event', 'email_tracking', 'mailing_id', '003'); ga('send', 'event', 'email_tracking', 'click_type', 'uchastnik')

Then to track user activity on the landing pages (i.e., we need to embed GTAG code on every page.

The following code should be inserted inside heading tags (<head>) . To set up automatic cross-domain tracking on the source domain for URLs pointing to the destination domain, configure the domains property of the linker parameter in your property's config. For example, this code will append the linker parameter to any links on the page that point to the target domain ''. This part I added in DTM

This code snippet represents modified version of the Gtag generic code with the following changes:

  • We enabled Google Analytics linker module to track same user between multiple domain names (i.e landing page and registration app).
  • We added the option to parse page GET-parameters and pass these parameters to Google Analytics custom dimensions (this is important option for tracking email activities).


Full example for links:

<a class="btn btn-primary btn-lgregister" onClick="gtag('config', 'UA-xxxxx-1', {'page_path':'/virtual/click/xxxxxx'});" href="" role="button" target="_blank">Регистрация</a>

Can anyone please assist with this.



Accepted Solutions (0)

Answers (0)