Here are even more ways you can customize your Piwik JavaScript tracking code.
This function will set the request method that Piwik uses to either the GET
or POST
methods. By default, this is set to GET
. In order to set Piwik's request method to POST
, your Piwik installation must be on the same server as the tracked website. Just add this function call above the trackPageView
call in your tracking code, like so:
... piwikTracker.setRequestMethod('POST'); piwikTracker.trackPageView(); ...
Some hosting providers use mod_security
, which blocks requests that contain URLs. In this case, Piwik will not be able to track URLs. If your hosting provider won't relax the settings for your account, one way around this mod_security
issue is to set Piwik's request method to POST
.