Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#1193 closed Bug (fixed)

non-javascript tracking enabled/disabled in global.ini

Reported by: mauser Owned by:
Priority: major Milestone: Piwik 0.5.5
Component: Core Keywords:
Cc: Sensitive: no

Description (last modified by vipsoft)

Currently Piwik tracks non-javascript browsers inspite of that FAQ says the opposite:
http://piwik.org/faq/new-to-piwik/#faq_63

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

By default set it to disabled..

  1. Update the FAQ. Add notes about what is/is not tracked for non-javascript browsers.
  1. How do we handle requests from crawlers/bots?

Change History (10)

comment:1 Changed 4 years ago by vipsoft (robocoder)

  • Description modified (diff)
  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.

comment:2 Changed 4 years ago by matt (mattab)

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.

comment:3 Changed 4 years ago by vipsoft (robocoder)

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
        else
            process normally (browser with javascript disabled)

    PostEvent('Tracker.Visit.isExcluded)

    // ...

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.

comment:4 Changed 4 years ago by matt (mattab)

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?

comment:5 Changed 4 years ago by matt (mattab)

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

comment:6 Changed 4 years ago by kaystrobach

@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...

http://www.webdigi.co.uk/blog/2010/google-analytics-for-facebook-fan-pages/

comment:7 Changed 4 years ago by matt (mattab)

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, ..)

comment:8 Changed 4 years ago by matt (mattab)

  • Resolution set to fixed
  • Status changed from new to closed

(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

comment:9 Changed 3 years ago by jackiboa

comment:10 Changed 3 years ago by jackiboa

Note: See TracTickets for help on using tickets.