angulartics / angulartics-google-analytics

Google Analytics plugin for Angulartics
MIT License
133 stars 86 forks source link

Incorrect ea parameter #109

Closed AndrewIsh closed 7 years ago

AndrewIsh commented 7 years ago

Hi

I'm making the following call:

$analytics.eventTrack('eventTrack', {
    category: 'Outlink',
    action: 'Click',
    label: 'Link to webpage'
});

Yet, in the request made to Google Analytics, I'm seeing:

ec:Outlink
ea:Link to webpage
el:Link to webpage

It looks as though ea is being wrongly assigned. I'm not sure if the object I'm passing to eventTrack() is correct for the Google Analytics plugin?

AndrewIsh commented 7 years ago

OK, taking a look at what is being passed as action to the registerEventTrack() callback, it's incorrect there. So I'm wondering if the problem is in Angulartics, I'm inclined to think I'm doing something wrong though as it seems too substantial a problem to exist in Angulartics! Going to do some more digging...

DanWilkerson commented 7 years ago

The first argument is your Action, then you pass in an object with your label etc. Take a look at the source file - there are annotations with parameters that ought to help.

https://github.com/angulartics/angulartics-google-analytics/blob/master/lib/angulartics-ga.js

The reason for this is that Angulartics core supports many analytics providers, so there's some funky syntax to make it work that doesn't always map to the original APIs :)

On Fri, Jun 9, 2017 at 5:40 AM Andrew Isherwood notifications@github.com wrote:

OK, taking a look at what is being passed as action to the registerEventTrack() callback, it's incorrect there. So I'm wondering if the problem is in Angulartics, I'm inclined to think I'm doing something wrong though as it seems too substantial a problem to still exist in Angulartics! Going to do some more digging...

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/angulartics/angulartics-google-analytics/issues/109#issuecomment-307344809, or mute the thread https://github.com/notifications/unsubscribe-auth/AFjNDaq-plIScz8Z8K3DgB8t-VeRj2JJks5sCRMigaJpZM4N1Hn6 .

-- Dan Wilkerson @notdanwilkerson 717-507-4231

AndrewIsh commented 7 years ago

Aha, I'd not appreciated that the first argument was the action, I just thought it was some arbitrary name. Changed that and ea is now being correctly assigned. Many thanks for your help!