angulartics / angulartics-google-analytics

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

Is 'dp' correctly populated in pageviews? #108

Closed AndrewIsh closed 7 years ago

AndrewIsh commented 7 years ago

Hi

Apologies if this is actually a question best suited for Angulartics, I wasn't sure, but since I'm using both Piwik and Google Analytics plugins and only seeing this in GA, I thought I'd start here :-)

I'm comparing what's sent to GA between pageviews and events and am seeing a disparity and, despite having consulted the GA documentation, am still not very clear if it's correct or not.

Here are a couple of the relevant parameters send for a pageview:

dl:https://mydomain.com/
dp:https://mydomain.com/#/buffer/2591

and for a subsequent event triggered on the same page:

dl:https://mydomain.com/
dp:/buffer/2591

My question is surrounding the dp parameter. According to the documentation:

Should begin with '/'. For 'pageview' hits, either &dl or both &dh and &dp have to be specified for the hit to be valid.

No mention is made of what form dp should take and whether it should differ between pageview hits and event hits. So I'm wondering why it is in this case and whether it's correct?

Is anyone able to shed any light on this? Thanks!

DanWilkerson commented 7 years ago

Hey, that's correct, the pageview should start with a / and not the entire domain. Could you share the settings you're using? I'll take a look.

AndrewIsh commented 7 years ago

Hi

The only setting I have that isn't default is:

$analyticsProvider.virtualPageviews(false);

Disabling this doesn't seem to make any difference.

Anything else I could check?

DanWilkerson commented 7 years ago

Hm, not sure - when I use those settings, I'm just seeing the path, not the whole URL:

https://embed.plnkr.co/E1pkruXFhMfvMGF0CK2y/

Anything else you can spot that may be different..?

AndrewIsh commented 7 years ago

Interesting, I'm not seeing any GA hit output in the console in that Plunker.

Here's a recording: https://drive.google.com/file/d/0B-pNMV5EBjtMZGFidzh2T3lUYjQ/view

The only difference I can see is that I'm explicitly calling:

$analytics.pageTrack($location.absUrl());

I'm wondering if the problem is my use of absUrl() here?

AndrewIsh commented 7 years ago

Just to update, switching to:

$analytics.pageTrack($location.url());

causes dp to be set correctly. So, that would appear to be my problem. Would you agree?

DanWilkerson commented 7 years ago

👍 Yep, that's it. That value just gets passed straight to the dp param.

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

Just to update, switching to:

$analytics.pageTrack($location.url());

causes dp to be set correctly. So, that would appear to be my problem. Would you agree?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/angulartics/angulartics-google-analytics/issues/108#issuecomment-307327331, or mute the thread https://github.com/notifications/unsubscribe-auth/AFjNDeAUeOi9X8nltjMwmkS8ex68m9d0ks5sCQCIgaJpZM4Nz3nK .

-- Dan Wilkerson @notdanwilkerson 717-507-4231

AndrewIsh commented 7 years ago

Aha, excellent. Mystery solved :) Now I just need to figure out how to make eventTrack() consistent. But that's not your problem! Thanks very much for the help, much appreciated.

DanWilkerson commented 7 years ago

Sure thing; happy to help!

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

Aha, excellent. Mystery solved :) Now I just need to figure out how to make eventTrack() consistent. But that's not your problem! Thanks very much for the help, much appreciated.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/angulartics/angulartics-google-analytics/issues/108#issuecomment-307383945, or mute the thread https://github.com/notifications/unsubscribe-auth/AFjNDe0yoBIdaGNXmbYhIV-Zk09OJ2RQks5sCUP1gaJpZM4Nz3nK .

-- Dan Wilkerson @notdanwilkerson 717-507-4231