Skip to content


non-javascript tracking enabled/disabled in global.ini #1193

zawadzinski opened this Issue · 8 comments

4 participants


Currently Piwik tracks non-javascript browsers inspite of that FAQ says the opposite:

  1. Add a configuration variable in global.ini that allows to disable/enable tracking non-javascript browsers.
    By default set it to disabled..

  2. Update the FAQ. Add notes about what is/is not tracked for non-javascript browsers.

  3. How do we handle requests from crawlers/bots?

  1. Instead of another setting, I can add a plugin (call it "NoScript") that hooks on Tracker.Visit.isExcluded, and ignores any visits where the 'rand' parameter is not set. (It is set by piwik.js on all requests: trackPageView, trackLink, and trackGoal.) In addition, move the Googlebot and Bing-bot detection out of Visit.php to this plugin. If someone later develops a bot detector, users can simply deactivate NoScript and activate the new plugin, and not mess around with overriding another configuration variable in config.ini.php.

we should limit as much as possible the number of "Tracker" plugins as execution time in tracking is critical; having a setting would be faster in this case.

Also, using the "rand" parameter to detect "JS" tracking mode is a good idea, but not ideal because in the future we might open the piwik.php? API for anybody to use (ie. tracking visits from a desktop software, or a widget, etc.) and they could generate the rand parameter to ensure cache bursting.

The problem is that currently we don't have a parameter in piwik.php for the noscript section, which we should... I suggest that we add a &js=1 in all piwik.php requests built with the piwik.js class ; Anthon, how does it sound?

  1. Bot requests: this is the reason why we are not tracking non-script requests by default, as we don't have a way to deal with bots traffic.

I'm still opposed to another config setting. How about we modify Tracker/Visit.php's isExcluded(): (pseudo-code)

    excluded = Googlebot || Bing bot detected
    if !excluded
        if (hasJavaScript) then
            process normally (browser with javascript enabled)
        else if UserAgentParser::getBrowser() == false then
            exclude visit
            process normally (browser with javascript disabled)


    // ...

Note: a caveat with adding js=1 is that the server will discard tracking requests where the user's browser is caching an old copy of piwik.js. If we go this route, it should be documented prominently in the changelog.


The issue is that we will not count browsers with disabled JS by default, so we need a setting of some sort (or a plugin, but this is heavier), to do the choice "counting non-JS or not"

very good point on the caching issue... do you know what is the standard caching policy for web servers? I think that piwik.js is checked by the webserver and 304 are returned if the file has changed since the request header "If-Modified-Since". should we still expect some users to hit the new 0.5.5 piwik with requests built with an old piwik.js?


To allow plugins to hook and record non-js visitors, we could have a hook that returns boolean, true if the visit should be saved, false if not. By default, if no plugins hook, the returned value would be false. A plugin could then easily hook and return true in all cases, ensuring that non-js visits are recorded


@matt, that sounds good

based on that we would have quite a lot of possibilities to make cool things like tracking visitors on facebook an so on...


Anthon, I will implement the solution

  • adding a js=1 parameter for requests done with piwik.js
  • by default, ignore requests missing the js=1
  • add a hook that would let a plugin record all visits regarding whether js=1 is set or not

kaystrobach, I would like to see such things done with Piwik, allowing to track visits on mysql, Facebook, or any other platform not allowing JS; to do so, we would need to document the API of piwik.php with the set of minimum parameters to set (eg. url, action_name, idSite, ..)


(In [1931]) Fixes #1193

Added parameter rec=1 to JS built requests to piwik.php

We can imagine other usage of rec=1 parameter, for example to force tracking of non-JS visits on myspace, facebook, or other JS disabled environments

@zawadzinski zawadzinski added this to the Piwik 0.5.5 milestone
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.