Categories
Blogs Free to use TIK Wordpress World Wide Web

Integrate multiple google analytics in one script

Tulisan ini berkaitan dengan penilaian GTMetrix poin Reduce unused JavaScript yang biasanya ditemukan pada bagian googletagmanager.com

This article is related to the GTMetrix points assessment Reduce unused JavaScript which is usually found in the googletagmanager.com section

Follow the guidelines from https://developers.google.com/analytics/devguides/collection/ga4/basic-tag?technology=gtagjs

So each google analytics code is separate, and if you use multiple analytics code in one website, then this can be simplified to:

https://www.googletagmanager.com/gtag/js?id=UA-XXXXXX-13
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-XXXXXX-13');
  gtag('config', 'G-XXXXXXXXXX');
</script>

Leave a Reply

Your email address will not be published. Required fields are marked *

Discover more from Just Shared on Tel-U

Subscribe now to keep reading and get access to the full archive.

Continue reading