Reply
Highlighted
Visitor
Posts: 1
Registered: ‎05-24-2018

How do we use a single gtag

Hi,

Is there a way of implementing a gtag? I am not able to find any articles related to it.

Thanks,

Nidhi

Frequent Visitor
Posts: 3
Registered: ‎08-08-2017

Re: How do we use a single gtag

[ Edited ]

Assuming you're asking about the latest Floodlight and Adwords gtag.js configuration as recommended by Google: 
https://support.google.com/searchads/answer/7563117?hl=en&vid=0-168058072095-1540175155034

The latest versions of the Floodlight and Adwords tags in the TiQ Tag Marketplace use the gtag.js deployment. 

Note: the u.hastagjs function in the Floodlight and Adwords tag templates will check and only load a single gtag.js from googletagmanager.com, but multiple Floodlight and Adwords tag deployments are supported in Tealium - this is a nice feature of these tags so that gtag.js is only requested once per page.  

u.hasgtagjs = function() {
            window.gtagRename = window.gtagRename || "" || "gtag";
            if (utag.ut.gtagScriptRequested) {
                return true;
            }
            var i, s = document.getElementsByTagName("script");
            for (i = 0; i < s.length; i++) {
                if (s[i].src && s[i].src.indexOf("gtag/js") >= 0) {
                    return true;
                }
            }
            window.dataLayer = window.dataLayer || [];
            if (typeof window[window.gtagRename] !== "function") {
                window[window.gtagRename] = function() {
                    dataLayer.push(arguments);
                }
                ;
                window[window.gtagRename]("js", new Date());
            }
            return false;
        }

 

Reply
0 Kudos