Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Global Site Tag (gtag) doesn't send anything

I've set up a new Analystics account, and copied over the tracking code. It's of the kind

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

I then track an event using

gtag('event', 'click', {
  event_category: 'acquisition',
  event_action: 'click',
  event_label: 'download',
  event_value: 1
});

I've tried all kinds of gtag() syntax, however nothing ever gets sent to Analytics. When checking the Network tab in Chrome debug tools, there is no communication with Google at all. (the dataLayer array is properly populated)

I don't want to use Google Tag Manager, just looking for a simple "track event via Javascript".

like image 539
Simon Avatar asked Oct 29 '25 09:10

Simon


1 Answers

Looks like it is working, might be a local computer/browser addon that's blocking the call to GAenter image description here

like image 116
XTOTHEL Avatar answered Oct 31 '25 13:10

XTOTHEL



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!