maartenba / GoogleAnalyticsTracker

GoogleAnalyticsTracker - A C# library for tracking Google Analytics
Microsoft Public License
290 stars 111 forks source link

GeneralParameters.ReferralUrl not used #126

Closed xmedeko closed 7 years ago

xmedeko commented 7 years ago

The GeneralParameters.ReferralUrl is not used, since the parameters in the BaseTracker.RequestUrlAsync contains properties with the BeaconAttribute only.

Note: TrackerBase.CharacterSet and Language seems unused, too.

maartenba commented 7 years ago

PR that removes these is welcome.

xmedeko commented 7 years ago

I am not sure if the ReferralUrl may be removed or it's usage has to be fixed.

xmedeko commented 7 years ago

I cannot find that Google Measurement uses HTTP Referer in the docs Reference Transport. I have found just the Document Referrer , but that is included in the request body, not the header.

So, I think the following may be removed (breaks backward compatibility) or it should be changed to the Document Referrer: GeneralParameters.ReferralUrl, TrackerBase.TrackingDomain (from the ctor, too), TrackerBase.TrackingDomainConfigurationKey.

I have just a limited experience with GA and app tracking, I know nothing about web page tracking, campaigns, etc. So, I do not know what is Document Referrer good for in GA. The TrackerBase.TrackingDomainConfigurationKey is used in the GoogleAnalyticsTracker.MVC4, MVC5, WebApi, WebApi2, Nancy.

maartenba commented 7 years ago

In that case let's leave it in - for web scenario's this will be needed.

xmedeko commented 7 years ago

But AFAIK HTTP Header "Referer" is not used by the GA (or does it?). It should be changed to the DocumentReferrer like the GoogleAnalyticsTracker.Owin.Tracker does already.

maartenba commented 7 years ago

I think they do use it, but not sure.

xmedeko commented 7 years ago

I would say that the plain Google Measurement Protocol does not use HTTP referer header field. But the Google Analytics JavaScript library uses transforms it to the Document Referer: This field is initialized by the create command and is only set when the current hostname differs from the referrer hostname ... (I guess it uses the document.referrer.) It's my understanding of the GA docs, I have not tested it though.

xmedeko commented 7 years ago

Yep, I've tried send an event by curl with the dr field and it has appeared as Full Referrer in the GA web gui. When I have removed the dr field and send the event by the curl --referer ..., then the Full Referrer is (direct).

maartenba commented 7 years ago

Hmmm... Up for another PR? :-)

xmedeko commented 7 years ago

But what should PR do?

  1. Just remove HTTP referer and TrackingDomain.
  2. Like 1. and change the code (GoogleAnalyticsTracker.MVC4, MVC5, WebApi, WebApi2, Nancy) to use DocumentReferrer.
  3. Keep TrackingDomain and set it as DocumentReferrer, if it is not set in the GeneralParameters.
  4. Remove TrackingDomain, merge this task with #124, make some DefaultParameters and change the code to use these DefaultParameters instead.
  5. ... ?
maartenba commented 7 years ago

2) I think

xmedeko commented 7 years ago

Ok, I will remove GeneralParameters.ReferralUrl, TrackingDomain, CharacterSet, Language. And I have found that TrackerBase.Hostname is used in the SimpleTracker only. So I will push it down there.

gandarez commented 7 years ago

I agree to remove those parameters since they are not mentioned any time in the documentation.

https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters