Hi. I’m using piwik in combination with the wordpress plugin. I’ve already informed the author of the plugin but I think you might be interested in too.
The following case is required that an javascript error occures:
The user has Firefox with Adblock and Dr. Evil’s Filter List (http://maltekraus.de/Firefox/adblock.txt) enabled. This list is widely used by German speaking users.
The list blocks “/piwik.js”. But does not prevent the execution of the javascript tag part of piwik.
So when piwik.js was not loaded the tag part throws an error because of undefined vars/functions and so prevents the further execution of any javascript that might would have been executed on the rest of the page.
I temporarily fixed this in the following way (fix is for the plugin, not for piwik itself):
<!-- Piwik code inserted by Piwik Analytics Wordpress plugin by Jules Stuifbergen http://blog.jongbelegen/piwik -->
<script language="javascript" src="<?php echo $options["jsurl"]; ?>" type="text/javascript"></script>
<script type="text/javascript">
<!--
if (typeof _pk_install_tracker == "undefined") {
$('footer').appendChild(new Element('img', {
'src': '<?php echo $options["phpurl"] . "?idsite=" . $options["siteid"]; ?>',
style: 'border:0',
alt: 'piwik'
}));
}
else
{
piwik_action_name = document.title;
<?php if ( ! $options["dltracking"]) { ?>
piwik_install_tracker = 0;
<?php } elseif ($options["dlextensions"] != '7z|aac|avi|csv|doc|exe|flv|gif|gz|jpe?g|js|mp(3|4|e?g)|mov|pdf|phps|png|ppt|rar|sit|tar|torrent|txt|wma|wmv|xls|xml|zip' ) { ?>
piwik_download_extensions = '<?php echo $options["dlextensions"]; ?>';
<?php } ?>
piwik_idsite = <?php echo $options["siteid"]; ?>;
piwik_url = '<?php echo $options["phpurl"]; ?>';
piwik_log(piwik_action_name, piwik_idsite, piwik_url);
}
//-->
</script><object>
<noscript><p>Web analytics <img src="<?php echo $options["phpurl"] . "?idsite=" . $options["siteid"]; ?>" style="border:0" alt="piwik"/></p>
</noscript></object>
<!-- /Piwik -->
The important part is:
if (typeof _pk_install_tracker == "undefined")
{
(add the static image for tracking)
}
else
{
(print default piwik code)
}
Regards
Philipp