User Tools

Site Tools


en:user_advanced:google_analytics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
en:user_advanced:google_analytics [2018/08/06 21:25] kjdonen:user_advanced:google_analytics [2018/08/06 23:15] kjdon
Line 27: Line 27:
   gtag('config', 'UA-xxx');   gtag('config', 'UA-xxx');
 </script> </script>
 +</code>
 +
 +If you are writing this into XSLT file, you need to format it like this:
 +
 +<code>
 +  <xsl:template name="addGoogleTracking">
 +    <xsl:variable name="trackid">UA-xxx</xsl:variable>
 +    <!-- Global site tag (gtag.js) - Google Analytics -->
 + <script async="async" src="https://www.googletagmanager.com/gtag/js?id={$trackid}"><xsl:text> </xsl:text></script>
 + <script>
 +   <xsl:text disable-output-escaping="yes">
 +   window.dataLayer = window.dataLayer || [];
 +   function gtag(){dataLayer.push(arguments);}
 +   gtag('js', new Date());
 +   
 +   gtag('config', '</xsl:text><xsl:value-of select="$trackid"/><xsl:text disable-output-escaping="yes">');</xsl:text>
 + </script>
 +  </xsl:template>
 +
 </code> </code>
en/user_advanced/google_analytics.txt · Last modified: 2023/03/13 01:46 by 127.0.0.1