Analytics: Installing the DataFeedWatch Tag in Google Tag Manager

Updated 2 months ago by DataFeedWatch

To install the DataFeedWatch Tag in Google Tag Manager, follow the steps below

  1. Go to Workspace > Variables, and create a new variable

Name = dfwTrackerVar
Type = Custom JavaScript
Use the Custom Javascript below
function() { function e() { function e() { return Math.floor(65536 * (1 + Math.random())).toString(16).substring(1) } return "dfwt" + e() + e() + e() + e() + e() + e() } function r(e, r) { function n(e) { 0 === e.indexOf('"') && (e = e.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, "\\")); try { return e.replace(/\+/g, " ") } catch (r) {} return "" } if (i(r)) { var o = new Date; return o.setTime(o.getTime() + 63072e6), t.cookie = e + "=" + r + ("; expires=" + o.toUTCString()) + "; path=/" } for (var c, f, d, a = e ? void 0 : {}, u = t.cookie ? t.cookie.split("; ") : [], l = 0, k = u.length; k > l; l++) { if (c = u[l].split("="), f = c.shift(), d = c.join("="), e && e === f) { a = n(d); break }!e && i(d = n(d)) && (a[f] = d) } return a } function i(e) { return null === e ? !1 : void 0 !== e } var t = document, n = "_dfwt", o = /dfw_tracker=([0-9a-zA-Z\-\_]+)/.exec(location.href); if (null !== o && i(o[1]) && (o = o[1]), "string" == typeof o) { var c = r(n); i(c) || (c = e(), r(n, c)); return c + "-" + o }}
  1. Go to Workspace > Triggers, set up the following trigger
Name = pages with dfw_tracker
Event = Page View
Trigger type = Page View
Fire On = Page URL contains dfw_tracker

  1. Go to Workspace > Tags and open your current Universal Analytics Tag
  2. Click the burger menu > Copy, and then Save

This will create a copy of your UA (Universal Analytics) Tag

  1. For convenience, change the name of this tracker to Universal Analytics with tracker
  2. Set the following: Custom Dimensions > Index to the Index of the dfw_tracker custom dimension that was created automatically in Google Analytics when you installed the DataFeedWatch Analytics

  1. Click Custom Dimensions > Dimension Value and set it to the following value
{{dfwTrackerVar}}Firing Triggers = page with dfw_tracker
  1. Click Save Tag button at the bottom
  2. Open the original Universal Analytics Tag again
  3. Under Fiering Triggers section, click Add Exceptions, select the pages with dfw_tracker trigger, and click Save

Now your original Workspace should look like this


How did we do?