Follow

DFW-Tracker Installation In Google Tag Manager

Please follow the instructions below only if you use Google Tag Manager for the Google Analytics tag.

  1. Go to Workspace > Variables and create a new variable: dfw_tracker_var.png

    • Name = dfwTrackerVar
    • Type = Custom JavaScript
    • Custom Javascript:
    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
    }
    }

    Go to Workspace > Triggers and set up the following trigger: trigger.png

    • Name = pages with dfw_tracker
    • Event = Page View
    • Trigger type = Page View
    • Fire On = Page URL contains dfw_tracker
  2. Go to Workspace > Tags and open your current Universal Analytics Tag and click the 'dots' button > "Copy" in the top right corner and save.  This will create a copy of your UA tag. copy.png

    For convenience, change the name of this tracker to "Universal Analytics with tracker".

    Set the following:

    • Custom Dimensions > Index = the Index of the dfw_tracker custom dimension that was created automatically in Google Analytics when you installed DFW-Analytics:dimensions.png Custom Dimension Index
    • Custom Dimensions > Dimension Value = {{dfwTrackerVar}}
    • Firing Triggers = page with dfw_tracker

      add_exeption.png

    Click the "Save Tag" button at the bottom, when you are finished.

  3. Open the original Universal Analytics tag again. Under “Fiering Triggers” section click “Add Exceptions”, select the “pages with dfw_tracker” trigger and click “Save”.
    add_ex_2.png

    Now your original Workspace should look like this:aaa.png

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk