update Piwik analytics code
This commit is contained in:
parent
3c2006eb13
commit
c055449ee0
|
@ -87,18 +87,25 @@ class PiwikAnalyticsPlugin extends Plugin
|
||||||
|
|
||||||
function onEndShowScripts($action)
|
function onEndShowScripts($action)
|
||||||
{
|
{
|
||||||
$js1 = 'var pkBaseURL = (("https:" == document.location.protocol) ? "https://'.
|
$piwikCode = <<<ENDOFPIWIK
|
||||||
$this->piwikroot.'" : "http://'.$this->piwikroot.
|
|
||||||
'"); document.write(unescape("%3Cscript src=\'" + pkBaseURL + "piwik.js\''.
|
<!-- Piwik -->
|
||||||
' type=\'text/javascript\'%3E%3C/script%3E"));';
|
<script type="text/javascript">
|
||||||
$js2 = 'piwik_action_name = ""; piwik_idsite = '.$this->piwikid.
|
var pkBaseURL = (("https:" == document.location.protocol) ? "https://{$this->piwikroot}" : "http://{$this->piwikroot}");
|
||||||
'; piwik_url = pkBaseURL + "piwik.php"; piwik_log(piwik_action_name, piwik_idsite, piwik_url);';
|
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
|
||||||
$action->elementStart('script', array('type' => 'text/javascript'));
|
</script>
|
||||||
$action->raw($js1);
|
<script type="text/javascript">
|
||||||
$action->elementEnd('script');
|
try {
|
||||||
$action->elementStart('script', array('type' => 'text/javascript'));
|
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 4);
|
||||||
$action->raw($js2);
|
piwikTracker.trackPageView();
|
||||||
$action->elementEnd('script');
|
piwikTracker.enableLinkTracking();
|
||||||
|
} catch( err ) {}
|
||||||
|
</script>
|
||||||
|
<!-- End Piwik Tag -->
|
||||||
|
|
||||||
|
ENDOFPIWIK;
|
||||||
|
|
||||||
|
$action->raw($piwikCode);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user