kronusaturn / lw2-viewer

An alternative frontend for LessWrong 2.0
https://www.greaterwrong.com/
MIT License
61 stars 6 forks source link

Google analytics doesn't seem to actually work #6

Closed Discordius closed 6 years ago

Discordius commented 6 years ago

It seems that the Google Analytics integration isn't actually currently working. I looked at the real-time tab in Google Analytics, while having multiple devices connected to it, and it didn't change at all. Also a lot of the traffics seems to be by some kind of bots.

This would be really great to fix, because if it turns out that you get a lot more traffic than you do, this would change how we relate to GreaterWrong a good bit.

jimrandomh commented 6 years ago

There's a Google Analytics tag in the page, and it loads https://www.googletagmanager.com/gtag/js?id=UA-109250968-1. It doesn't make any followup http requests, though. If Google Analytics Debugger (a Chrome extension) is installed, this appears in the Javascript console:

       _                 _
  __ _| |_ __ _  __ _   (_)___
 / _` | __/ _` |/ _` |  | / __|
| (_| | || (_| | (_| |_ | \__ \
 \__, |\__\__,_|\__, (_)/ |___/
 |___/          |___/ |__/

js?id=UA-109250968-1:75 Processing commands (2)
js?id=UA-109250968-1:75 Processing GTAG command: ["js", Tue Sep 04 2018 15:31:16 GMT-0700 (Pacific Daylight Time)]
js?id=UA-109250968-1:75 No tags fired for event: gtm.js
js?id=UA-109250968-1:75 Processing GTAG command: ["config", "UA-109250968-1"]
js?id=UA-109250968-1:75 Ignored "config" command. Invalid arguments found.
js?id=UA-109250968-1:75   Expected: "[string, object]"
js?id=UA-109250968-1:75   Actual:   ["config", "UA-109250968-1"]
js?id=UA-109250968-1:75 Processing commands (1)
js?id=UA-109250968-1:75 Processing data layer push: {event: "gtm.dom", isEmpty: [function]}
js?id=UA-109250968-1:75 No tags fired for event: gtm.dom
js?id=UA-109250968-1:75 Processing commands (1)
js?id=UA-109250968-1:75 Processing data layer push: {event: "gtm.load", isEmpty: [function]}
js?id=UA-109250968-1:75 No tags fired for event: gtm.load

Which is pretty suggestive, but the call to gtag where it's complaining about the type of the second argument is a direct copy-paste from the Analytics admin settings section.

kronusaturn commented 6 years ago

I replaced gtag.js with analytics.js and it appears to work again. Why does one work and not the other? Google is a bitter mystery.

Discordius commented 6 years ago

Alas. But thanks a lot for fixing it.

On Thu, Sep 6, 2018 at 2:20 AM kronusaturn notifications@github.com wrote:

I replaced gtag.js with analytics.js and it appears to work again. Why does one work and not the other? Google is a bitter mystery.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kronusaturn/lw2-viewer/issues/6#issuecomment-419025422, or mute the thread https://github.com/notifications/unsubscribe-auth/AIq25eDIneTDzkeNw21A0Gubh1bFTE4Vks5uYOjIgaJpZM4WZrEU .