Skip to content

Commit 9c5f841

Browse files
authored
Merge pull request #765 from gitnnolabs/add_G4
Adiciona o G4 Google Analytics.
2 parents 1c44985 + f616220 commit 9c5f841

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

htdocs/xsl/sci_common.xsl

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -648,22 +648,23 @@
648648
</xsl:if>
649649
<!-- End Piwik Code -->
650650

651-
<!-- to use Google Analytics -->
651+
<!-- to use Google Analytics G4-->
652652
<xsl:if test="//varScieloOrg/GOOGLE_CODE != ''">
653-
<script type="text/javascript">
654-
var _gaq = _gaq || [];
655-
_gaq.push(['_setAccount', '<xsl:value-of select="//varScieloOrg/GOOGLE_CODE"/>']);
656-
_gaq.push(['_trackPageview']);
657-
_gaq.push(['_setSampleRate', '<xsl:value-of select="//varScieloOrg/GOOGLE_SAMPLE_RATE"/>']);
658-
659-
(function() {
660-
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
661-
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
662-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
663-
})();
653+
654+
<!-- Google tag (gtag.js) -->
655+
<script async="">
656+
<xsl:attribute name="src">https://www.googletagmanager.com/gtag/js?id=<xsl:value-of select="//varScieloOrg/GOOGLE_CODE"/></xsl:attribute>
657+
</script>
658+
<script>
659+
window.dataLayer = window.dataLayer || [];
660+
function gtag(){dataLayer.push(arguments);}
661+
gtag('js', new Date());
664662

663+
gtag('config', '<xsl:value-of select="//varScieloOrg/GOOGLE_CODE"/>');
665664
</script>
665+
666666
</xsl:if>
667+
<!-- to use Google Analytics G4-->
667668
<xsl:if test="//varScieloOrg/PINGDOM_CODE != ''">
668669
<script>
669670
var _prum = [['id', '<xsl:value-of select="//varScieloOrg/PINGDOM_CODE"/>'],

0 commit comments

Comments
 (0)