Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Updated Piwik script

This discussion is related to the Piwik Analytics addon.

Hello!

I have edited the code in .../Piwik/class.piwik.plugin.php to conform to the new tracking code provided by the Piwik package.

Old code (starting at line 65):

<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(["trackPageView"]);
  _paq.push(["enableLinkTracking"]);

  (function() {
    var u=(("https:" == document.location.protocol) ? "https" : "http") + "$PiwikInstall";
    _paq.push(["setTrackerUrl", u+"piwik.php"]);
    _paq.push(["setSiteId", "$PiwikSiteID"]);
    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.js"; s.parentNode.insertBefore(g,s);
  })();
</script>
<noscript>
<!-- Piwik Image Tracker -->
<img src="$ImageTrack/piwik.php?idsite=$PiwikSiteID&amp;rec=1" style="border:0" alt="" />
<!-- End Piwik -->
</noscript>
<!-- End Piwik Code -->

New code:

<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="$PiwikInstall";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', '$PiwikSiteID']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
  })();
</script>
<noscript>
<!-- Piwik Image Tracker -->
<img src="$ImageTrack/piwik.php?idsite=$PiwikSiteID" style="border:0" alt="" />
<!-- End Piwik -->
</noscript>
<!-- End Piwik Code -->

For this to work properly, line 33 should be changed to:

                'Plugins.Piwik.PiwikInstall' => array('LabelCode' => 'PiwikInstall', 'Control' => 'TextBox', 'Default' => C('Plugins.Piwik.PiwikInstall', '//www.example.com/piwik/')),

And anyone changing this on a board with the plugin enabled should change the 'PiwikInstall' setting to //www.example.com/piwik/ (leave out the http or https).

Tagged:
vrijvlinderBleistivthgtonightAdrian

Comments

Sign In or Register to comment.