Permalink
Browse files

small minor changes and comments

  • Loading branch information...
1 parent 8021a4e commit 3f69cf0be29e6ff30f8aefa945c1ef41dbb052d2 @LRancez LRancez committed Apr 9, 2016
Showing with 5 additions and 3 deletions.
  1. +1 โˆ’1 README.md
  2. +4 โˆ’2 ga-beacon/ga-beacon.go
View
@@ -34,7 +34,7 @@ Or RDoc:
If you prefer, you can skip the badge and use a transparent pixel. To do so, simply append `?pixel` to the image URL. There are also "flat" style variants available, which are available when appending `?flat` or `?flat-gif` to the image URL. And that's it, add the tracker image to the pages you want to track and then head to your Google Analytics account to see real-time and aggregated visit analytics for your projects!
-You may also auto-calculate the tracking path based in the "referrer" information of the image. To activate this simple add `?useReferrer` to the image URL (or `&useReferrer` if you need to combine this with the `?pixel`, `?flat` or `?flat-gif` parameter). Although they are some odd browsers that don't always send the referrer, the amount of traffic coming from those browsers is usually not relevant at all. Of course that if you need to measure the traffic from those odd browsers you should not use this method.
+You may also auto-calculate the tracking path based in the "referer" information of the image. To activate this simple add `?useReferrer` to the image URL (or `&useReferer` if you need to combine this with the `?pixel`, `?flat` or `?flat-gif` parameter). Although they are some odd browsers that don't always send the referer header, the amount of traffic coming from those browsers is usually not relevant at all. Of course that if you need to measure the traffic from those odd browsers you should not use this method.
@JamieMason
JamieMason Nov 28, 2016

There are two spellings here: ?useReferrer and &useReferer.

I copied the useReferer version and do not get referral data in GA, so I think the value should be useReferrer? But I'm not completely sure as the spelling of the query in ga-beacon/ga-beacon.go was also changed in this commit.

Thanks.

/cc @igrigorik

@JamieMason
JamieMason Nov 28, 2016 edited

Please forgive me if I'm mistaken, but I'm referring to the names of the query params of ga-beacon's own API rather than the name of the HTTP Header.

1) https://ga-beacon.appspot.com/UA-XXX/foo?flat&useReferer
2) https://ga-beacon.appspot.com/UA-XXX/foo?flat&useReferrer

I suppose what I'm asking is: For the image URL in my README, should I use URL 1, 2, or will either of them work? Currently I'm using URL 1 but that doesn't show referrer data in my google analytics.

@igrigorik
igrigorik Nov 28, 2016 Owner

Doh, apologies.. misread your earlier comment. You should use one 'r': https://github.com/igrigorik/ga-beacon/blob/master/ga-beacon/ga-beacon.go#L106. Fixed in https://github.com/igrigorik/ga-beacon/blob/master/README.md.

Re, doesn't show up: note that not all requests cary a Referer header, see: https://www.w3.org/TR/referrer-policy/

@JamieMason
JamieMason Nov 28, 2016

thanks a lot @igrigorik, appreciate the help.

### FAQ
@@ -102,11 +102,13 @@ func handler(w http.ResponseWriter, r *http.Request) {
return
}
- // activate referrer path if ?useReferrer is used and if referer exists
- if _, ok := query["useReferrer"]; ok {
+ // activate referrer path if ?useReferer is used and if referer exists
+ if _, ok := query["useReferer"]; ok {
if len(refOrg) != 0 {
referer := strings.Replace(strings.Replace(refOrg, "http://", "", 1), "https://", "", 1);
if len(referer) != 0 {
+ // if the useReferer is present and the referer information exists
+ // the path is ignored and the beacon referer information is used instead.
params = strings.SplitN(strings.Trim(r.URL.Path, "/") + "/" + referer, "/", 2)
}
}

0 comments on commit 3f69cf0

Please sign in to comment.