Reputation: 93
I am using gtag and event tracking. However, it doesn't count at all... I have no idea why it doesn't work even though I clicked the link. Always it shows 0. Please give me any advice. Thanks.
<script async src="https://www.googletagmanager.com/gtag/js?id=my id"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'my id');
</script>
<a href="/news/" onclick="gtag('event', 'click', {'event_category': 'button','event_label': 'test'});">test link</a>
Upvotes: 0
Views: 172
Reputation: 86
I am using the following construction:
<a href="/" onclick="gtag('event', 'click', { event_category: 'social', event_action: 'click', event_label: 'email', event_value: 1 })">Link</a>
it works for me:
P.s. I didn't configure anything on GTM and GA.
Upvotes: 1