Anyone Using Cloudflare's Google Analytics App?


(James Mc Mahon) #1

Wondering if anyone else here been using the Google Analytics “app” in cloudflare and noticed a BIG spike in bounces and a drop in reported pageviews since the version update (approx three weeks ago).

At first the code simply stopped loading on all of my sites when I updated the GA app in CF. (Multiple platforms).
Then, once that was fixed I noticed a big difference between pageviews between GA and Discourse, a big drop in the totals in GA in general and the bounce rate went from 12% to 60%!

After digging around today, all I can say is that for some reason the GA code delivered by Cloudflare was only picking up (and was stuck on) the page url that a visitor landed on.
I removed/re-added the app in CF, disconnected it from my GA account, added/removed URLs from the app etc etc, cleared CF caches etc but no change.

Resolution: Use the GA field in Discourse I guess, once I did that everything went back to normal :wink:


(Joe) #5

I think this occurs because the cloudflare app injects the Google analytics script in the <head>.

This works well if you’re on a regular website where new html pages - and new <head> elements - are loaded on navigation, but it does not work well with apps like Discourse.

Discourse as a Single Page Application only loads the <head> once and swaps the <body> content on subsequent navigation.

This results in Google Analytics thinking that only 1 page has been viewed and the behavior you described

Discourse has it’s own method of letting Google Analytics know that the page has changed on user navigation, and has it’s own Google analytics fields in the admin to ensure proper implementation.


(James Mc Mahon) #6

It seemed like it was working great for… months. Then I logged into CF, saw there was an update for the GA app and well, you know the rest.

Initially I was using it to track signups because the “account-created” URL didn’t have the GA code on it.

Otherwise though, I’m pretty happy cloudflare in general. But when I saw bounce go up by 385% and pageviews go down by 56% I figured something was up.

But yes, Discourse’s built-in support works swimmingly well. :+1:


(James Mc Mahon) #7

Has anything changed in the way Discourse reports visits to GA during this year?

Things look better after having discourse manage the GA code… Reported bounce rate in GA has improved, but it’s still nowhere near the 25% or so I was seeing for a long time.

Now I realize it could be my visitors too :smiley: but it’s such a marked change that I’m having trouble believing that.

I’m on v1.9.0.beta8 +36 currently. I seem to have problems with docker taking a dump on my server when I upgrade, so I tend to do it less often.