Close

Integrate multiple google analytics in one script

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>

This post is also available in: Indonesian

Silakan berikan komentar, pertanyaan, maupun sanggahan. InsyaAllah dibalas secepatnya.

© Just Shared on Tel-U | WordPress Theme: Annina Free by CrestaProject.
%d bloggers like this: