Can't get Google Analytics to work



  • I'm aware that there's a Google Analytics plugin by @julian, but after installing it, activating it, putting the tracking code in the required field, saving the changes and restarting my NodeBB, neither did the tracking script show up in my front-end code (which Julian himself had explained in another thread here) nor did my Google Analytics show any activity in the real time report.

    I then tried putting the whole tracking script in (i) custom header as a script, and (ii) a footer widget, restarting NodeBB multiple times along the way. Both of them showed the script in the front-end code, but my Google Analytics was still silent. As I write this, my NodeBB still runs without an active GA implementation.

    I'm not exactly happy with any of the available solutions (regardless of whether they worked or not), since none of them seems to put the tracking code in the place where GA recommends it to be. Julian must be aware that the GA script needs to load before the page's HTML content is loaded in order to capture any DOM changes and stuff, but putting it in a footer widget to dynamically load after the page HTML loads.... defeats the whole purpose.

    We chose NodeBB out of other alternatives for our latest project, and have learned the ropes fine so far, though the road was bumpy. I only think that the core package needs a few important functions inbuilt, instead of relying on plugins which may or may not be upgraded in tandem with newer versions of the core package. I have another thread opened here since last week that still needs solving. I sincerely hope that the community helps us get along, and that we made the right decision by choosing NodeBB. Thanks to the NodeBB team for the excellent work they've done, though. No mistaking that.



  • Could anyone help out, please? @julian, maybe?


  • Global Moderator

    @karthiks

    none of them seems to put the tracking code in the place where GA recommends it to be

    A recommendation is just a recommendation. If it works, it works.

    Julian must be aware that the GA script needs to load before the page's HTML content is loaded in order to capture any DOM changes and stuff

    I'm no expert but this doesn't sound right.


  • GNU/Linux

    @karthiks said in Can't get Google Analytics to work:

    Julian must be aware that the GA script needs to load before the page's HTML content is loaded in order to capture any DOM changes and stuff

    You don't even need a plugin for this, I think... You only need to add the Google Analytics script on <head>, so you should paste your code on ACP Custom Header Content, just like that:

    dd565b71-3731-43c9-bc9c-99ce593475c6-image.png

    Then click on the slider below "Enable Custom Header" to enable it, click on the floppy disk to save it and the code you pasted will be loaded on the <head> of all your NodeBB pages.

    I have it on my site and it tracks the pages perfectly.


  • Community Rep

    @karthiks It sounds like one of your other scripts is failing. This one of the reasons Google recommends it go in the head section. It's less likely another script failing will cause GA not to load properly.


  • Community Rep

    We never got it to work at all, we gave up. We have CloudFlare in front of us and get data from there. Not as detailed as Google, but WAY more accurate.


Log in to reply
 

Suggested Topics

| |