Topic on Extension talk:GTag

Add Google Tag Manager options as well?

2
Blinkingline (talkcontribs)

Would it bepossible to add Google Tag Manager configuration with this as well? As Google moves to "tag-based" analytics, I could see there being some value with adding these via an extension.

The Tag Manager requires two snippets where GTM-XXXXXX is a unique identifier. The first one, "as high in within the <head> as possible:"

<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':

new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],

j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=

'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);

})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>


And this one just after the opening <body> tag:

<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"

height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

CarolinaReidBangingRocksDev (talkcontribs)

@Blinkingline Were you able to find a solution to this (add a Google Tag Manager) in your MediaWiki site? I am facing the same problem.

Reply to "Add Google Tag Manager options as well?"