Categories
Blogs Free to use ICT 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>

By Hilfan Soeltansyah

Bapak dari 2 anak lelaki, yang memiliki passion di kewirausahaan dalam bidang ICT, kerja di dunia pendidikan Telkom University di Direktorat Pusat Teknologi Informasi Tel-U.
https://hilfan-s.blogspot.com

Leave a Reply

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