Thread Starter
Rookie
(@alriksson)
Or am I seeing it wrong and this should work?:
Can you confirm as well would still update and change the library of minimal GA 4.
<a class="button" href="#" onclick="gtag('event', <action>, {
'event_category': <category>,
'event_label': <label>
});">
<span class="button_label">Start now
</span>
</a>
Event tracking doesn’t work at the moment, but I’m working on adding the new library as we speak. I’m dropping a new release this Friday in which it’ll be included!
Thread Starter
Rookie
(@alriksson)
@daanvandenbergh Ok Friday means just before end of UA, but good.
Do you mean global event tracking or both? As you see what I’m looking for is the minimalism to add onclick event. Am I understanding it correct I can with the new minimal analytics GA 4 library when you updated and use the following:
<a class="button" href="#" onclick="gtag('event', <action>, {
'event_category': <category>,
'event_label': <label>
});">
<span class="button_label">Start now
</span>
</a>
Or only global dynamic tracking that runs onload at all times? Not optimal as I want minimalism and only trigger on click.
track({ type: 'user_signup', event: { 'epn.user_id': 12345, 'ep.user_name': 'John', });
Yes, UA will be removed in that version, but I’m releasing it so people can make the switch in time, before Google Analytics pulls the plug on UA.
I’m adding the jahilldev library. You’d have to check his documentation to see how that should work. I think only your last example will work.
Thread Starter
Rookie
(@alriksson)
@daanvandenbergh unfortunately no documentation regarding onclick events but raised an issue to see if he can shine some clarity regarding that.
But the gtag onclick event works on the normal GA4 script right? That they have not changed?
If by ‘normal GA4 script’ you mean the script provided by Google, then yes, I’m pretty sure that should still work.
Thread Starter
Rookie
(@alriksson)
@daanvandenbergh thanks!
If you can have the GA4 minimal version updated I will test below. Got an answer. So can you make sure yo have settings to enable that as well?
Provided you’ve set defineGlobal: true in the config options for @minimal-analytics/ga4, you should be able to do something like the following:
<a href="https://website.com" onclick="track({ /*[...]*/ })">Click</a>
yes, I’ve added the defineGlobal parameter!
Thread Starter
Rookie
(@alriksson)
@daanvandenbergh Perfect. Keep me posted today when the update is released.
Thread Starter
Rookie
(@alriksson)
@daanvandenbergh amazing! and it comes with both?
autoTrack: true,
defineGlobal: true,
Thread Starter
Rookie
(@alriksson)
Cannot see the tracking code being added Tracking Code Position footer.
This site is using oxygen builder. Shouldn’t need to use the option to add manually?
Do you have a site URL? You can share it with me using this contact form if you don’t want to share it here.
Thread Starter
Rookie
(@alriksson)
what should I be looking for? used flying analytics before, still activated but only loading old UA script and tracking.