What is the recommended method to integrate the PiwikPro code into a WordPress website?
Manually add the code to my header file?
Using the PiwikPro WordPress plugin?
Regarding the plugin; it has very few users (less than 1000?!) and has not been updated for 4 months. Is this plugin still actively maintained and recommended?
The best way to integrate our product with WordPress is to use our official plugin. It’s actively maintained, but very stable, so there was no reason to release updates for a while. It replaced a previous version, so the usage stats are not completely accurate.
When I use the WordPress plugin the code is installed after the closing /head tag.
It is before the closing /header tag but not in the /head like GA code is.
Would it not be better to install the PiwikPro code manually and place it before the closing /head tag?
Piwik PRO code has slightly different rules than GA’s snippet - it’s best to leave it as it is.
Basically, the WordPress plugin loads the Piwik PRO Tag Manager and not just Analytics. Because of that, it has an asynchronous tagging container which should be loaded from <body> and a synchronous one that loads from <head>. This way you can use both synchronous and asynchronous tags in our Tag Manager.
The <noscript> tag is useful when JavaScript is not enabled on the website. It also enables you to use <noscript> in Custom tags in Piwik PRO Tag Manager, so that you can also use other marketing pixels (not just our Analytics) when JavaScript is not enabled.
In the meantime I have uninstalled the PiwikPro plugin from my WordPress sites… just because I don’t like to install plugins (already too many on my sites) if it is not necessary.
So I did install the code manully and placed it in the header.php file from my sites, just before the closing /head tag.
Maybe you can check on one of my sites to see if the code is installed correctly like this:
I then compared the number of page views counted between piwikpro and google analytics version 4. I wanted to compare this because with the piwikpro wordpress plugin installed, piwkpro registers about 15% less page views than google analytics (both pwikpro and google analytics without ip filters). I tested each of the 3 methods above for 2 weeks, so complete test toke 6 weeks. I find the result remarkable, which is why I share it here:
1 - With the piwikpro wordpress plugin, piwikpro registers about 10 to 15% fewer page views every day than google analytics.
2 - Manually installed with the same piwikpro code (including tag manager) and placed before the closing head tag (the wordpress plugin places the code lower, below the closing head tag and just above the closing header tag) piwikpro registers about 5% less page views than google analytics. So more pageviews then using the plugin.
3 - With the shortened pwikpro code (without tag manager) and placed above the closing head tag, pwikpro registers about 5% more page views than google analytics every day…
Conclusions:
With the wordpress plugin pwikpro is missing quit a lot of page views
With the code higher in the page, more page views are registered, still les then in google analytics
With the short code, without the tag manager part, the number of registered page views is considerably higher! The difference between this method and using the plugin is around 15 to 20%…
I just wonder, is this expected behavior? Is placing the code lower on the page increasing the risk of missing page views? And is using the tag manager also increasing the risk of missing page views? Because in my test it does…
That’s really interesting. I’d suspect that some javascript errors are blocking some of the requests. Would it be an option to install an additional tool to capture all js errors while doing tests (there are many such tools, e.g. fullstory)? You could also check within the UI if tere are any js errors tracked (that’s the default setting and errors should be reported as custom events).