Closed romgere closed 2 months ago
@romgere What version of Google Analytics are you using? Are you using V4 via the Tag Manager?
@hilljh82 I won't lie I'm not sure, I can't find any "version" indicator in Google Analytics / Tag manager... I created the tag 1 year ago, so I was assuming that it's a v4 🤷🏻♂️
I was using version 1.2 with v4 config & didn't change it when upgrade to 1.5 :
'ember-cli-google': {
analytics: {
version: 'v4',
measurementId: 'G-47QBQ5GB3Y',
},
},
I guess, if it was working with 1.2, it's a v4 tag 🤔
I used Tag assistant to debug my gtag integration & I found that the event
method of gtag
service is not working properly (at least for my needs)...
According to documentation event should be send like this :
gtag('event', <action>, {
'event_category': <category>,
'event_label': <label>,
'value': <value>
});
So implicitly gatg
function is using :
dataLayer.push(['event', <action>, {
'event_category': <category>,
'event_label': <label>,
'value': <value>
}])
But in gtag
service, the event
function is doing :
dataLayer.push({
'event': <action>
'event_category': <category>,
'event_label': <label>,
'value': <value>
})
Which (according to the doc) is not the way to send custom event ...
I tried changing gtag
service event
function to this :
event(name, params) {
this.push('event', name, {...params });
}
And I can now see my custom event poping in Tag assistant debugger :
That make me wondering if the gtatg
service event
function has been done for sending custom event ? I'm figuring out that previously I was not using the gtatg
service, but I was calling directly gtag(...)
function in my app (aka. I was just using ember-cli-google-analytics
add-on to inject the gtag js script in my app 🤔)
Another thing I noticed, is that gtag script was previsouly injected by packages/ember-cli-google-analytics/index.js at app build where now, the script is injected at run time when gtag
service is first used.
I think this change can make a huge difference, given, is the consuming app is not using the gtag
service, script won't be injected in app 🤔
I fixed issue on my side, so from my POV this can be closed, but I let you closing this issue given there may be some action you want to take regarding what was discussed here. Thx !
Hi there,
I recently update to ember-cli-google-analytics@1.5.0 on one of my pet project (was previously on 1.2) & I think there's something wrong (maybe my integration) because since I got huge decrease of events on my web site :
Here is gtag related changes :
Any clue on what's happening there ? Did I miss something in the changes from 1.2 to 1.5 🤔
Thanks !