neg404
neg404

Reputation: 93

Google Analytics gtag doesn't count

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.

GA screenshot

<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

Answers (1)

Roman
Roman

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:

Google analytics Events

P.s. I didn't configure anything on GTM and GA.

Upvotes: 1

Related Questions