Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bots are not tracked and the 'bots' argument is not sent/ignored #5911

Closed
dessant opened this issue Aug 3, 2014 · 1 comment
Closed

Bots are not tracked and the 'bots' argument is not sent/ignored #5911

dessant opened this issue Aug 3, 2014 · 1 comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. worksforme The issue cannot be reproduced and things work as intended.

Comments

@dessant
Copy link

dessant commented Aug 3, 2014

I have changed my user agent to spider for this test, i'm using the proxy mode with this client code:

<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(["setCookieDomain", "*.example.com"]);
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  _paq.push(['appendToTrackingUrl', 'bots=1']);
  (function() {
    var u=(("https:" == document.location.protocol) ? "https" : "http") + "://example.com/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', 3]);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript';
    g.defer=true; g.async=true; g.src=u+'piwik.php'; s.parentNode.insertBefore(g,s);
  })();
</script>

The bots parameter is omitted when the tracking request is sent:

GET http://example.com/piwik.php?action_name=TITLE&idsite=1&rec=1&r=538744&h=18&m=2&s=8&url=http%3A%2F%2Fexample.com%2F&_id=3ddf8ebeff5e69e5&_idts=1407077879&_idvc=1&_idn=0&_refts=0&_viewts=1407077879&pdf=0&qt=0&realp=0&wma=0&dir=0&fla=1&java=0&gears=0&ag=0&cookie=1&res=1366x768&gt_ms=334

If i change back my user agent to the real one, the request is tracked as expected.

@sgiehl
Copy link
Member

sgiehl commented Aug 3, 2014

Bots are not tracked by default. So as long as the bots=1 is not send with the tracking url, all detected bots will be ignored.
You need to call _paq.push(['appendToTrackingUrl', 'bots=1']); before _paq.push(['trackPageView']); Otherwise the bots=1 parameter will be appended to all requests (on that page) after the inital page tracking request.

@sgiehl sgiehl closed this as completed Aug 3, 2014
@mattab mattab added the Bug For errors / faults / flaws / inconsistencies etc. label Sep 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. worksforme The issue cannot be reproduced and things work as intended.
Projects
None yet
Development

No branches or pull requests

3 participants