Tracking with Google Site Tag (gtag.js)

Google Analytics Events tracking with Global Site Tag (GA4 & gtag.js)

Google Tag Tracking code installation

For events tracking the GA4 gtag.jsarrow-up-right must be installed for your webpage. For more information what the gtag is check the Google Tagarrow-up-right documentation.

The tracking code should look something like this, and should be in your site header:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-1234567890"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'G-1234567890');
</script>

After the tag installation see the Events Tracking to setup the desired events to track.

Last updated