Analytics tracking code in global footer widget

NodeBB Development
  • I put a couple of analytics tracking tags (for Piwik and Quantcast) in the default HTML widget in the Global footer widget area, but they do not show up when I view the source of any of the site's page. But because I'm using Lavender, I had to add the tags to the footer.tpl file of Vanilla. But even at, visitor traffic is barely registering.

    Is there something special that needs to be done before analytics tracking codes can work as expected with NodeBB?

    This is related to an earlier post. See Unique visitor stats

  • Actually, widgets are dynamically inserted after loading, so you wouldn't see it via view-source. We did that to speed up the actual page loading time, although we later realized that this doesn't play nice with browsers that have noscript enabled. In short, yeah we'll be rendering widgets on cold load in the near future

    I don't think it specifically has anything to do with your problem though, ie. it should work regardless. Any errors? Maybe its something similar to the document.write problem you had with AdSense

  • @psychobunny

    I think the issue of tracking and how NodeBB works is something that has to be given a new look, especially for those who might want to monetize their traffic. AJAX is great, but commercial publishers hate it. I guess that's why it's not very popular with the likes of Facebook and other social networks.

    Since commercial publishers have to monetize their traffic (user activity), every one of those activities has to count (and be reflected in their analytics app), especially those that present a different page to a user.

    @bentael suggested a solution here (using action:ajaxifying, action:ajaxified, and action:page.load. Is that something that can be used site-wide? If, so how best to go about implementing it?

  • @julian's done something like this for his Google AdSense plugin, he might be able to shed some light. But I would imagine that at that point one may as well write an actual plugin for it rather than code it as a widget

  • @psychobunny

    Considering that, as far as commercial publishers are concerned, that this is something that could negatively impact the adoption of NodeBB, don't you think this is something that shold be taken up by the Core devs.

    No, I'm not trying to put pressure on anybody, but as a core-bundled plugin, this would be great to have with every installation of NodeBB.

  • don't you think this is something that shold be taken up by the Core devs.

    @julian is a core dev, well, unless you've recently fired him. 😛

    for his Google AdSense plugin

    Ah, woops. I meant Google Analytics, by @julian, ie. would probably be about the same code to accomplish the above.

    @bentael suggested a solution here

    It was @julian 😛 I guess monday is identity crisis day

  • This is all the code I need to push new page events to GA. Piwik or Quantcast ought to have something similar.

  • @psychobunny

    Nah, @julian is too nice of a guy to be fired. He's yours 'till Thy Kingdom Come 😉


Suggested Topics


  • 0 Votes
    5 Posts
    388 Views

    EDIT:

    @baris error is gone / fixed. Thank you!

  • 0 Votes
    1 Posts
    615 Views

    I'm a developer but new to nodebb. I want to display some post-specific content in the footer of that post, so I need to access the post ID via Javascript and update some view. Any pointers/tips would be appreciated.

  • 0 Votes
    1 Posts
    2k Views

    I am writing a plugin.

    Can anybody pl. write the code pattern for this requirement of mine...

    When a logged in user enters some data, the backend should do the following in response:

    The user sends the data to the NodeBB backend in the following format:
    { key1: data-value1, key2: data-value2, ... }

    Get the user id of the user and check if the key1, key2, etc. already exists in the Mongo DB (the user's collection/document)

    If yes, overwrite the data

    If not, store the data

    Tell the client that the action has been taken

    Actually, it is quite simple if you're writing an app from the scratch. What I am looking for is the pattern/way the NodeBB is currently handling this scenario and I want to code using the same pattern.

    Thanks

  • 0 Votes
    8 Posts
    3k Views

    Sorry for necromancy but I have exactly the same problem as @shri to change sidebar bootstrap properties...

    With the latest nodebb version, do I need to do the same hack modifying directly the widget.js code ?

  • Widget system

    NodeBB Development
    0 Votes
    2 Posts
    1k Views

    https://github.com/NodeBB/nodebb-widget-essentials/blob/master/library.js#L80-L113

    Should give you some ideas, the active users widget changes behaviour based on where it is displayed, if its inside a topic it shows the poster in that topic, if its inside a category it shows recent posters in that category etc. widget.area.url gives the url of the page the widget is in.