Best method integrate piwik in WordPress?

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?

Thanks a lot :slightly_smiling_face:
Alwin

Hello @optipiwik,

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.

Hello Piotrek,

Thank you for your fast reply. I will just use the plugin then :slight_smile:

Hello Piotrek,

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?

  • I see extra code when I use the WordPress plugin:

<noscript><iframe src="https://option-webdesign.containers.piwik.pro/0ac0d197-f254-48d9-9ffa-67ba0e222f8d/noscript.html" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><div id='wrap_all'>

This extra code is for what?

Thank you,
Alwin

Anyone can help me with this? Need to setup 10 sites for my clients :slight_smile:

Thanks a lot,
Alwin

Sorry for the late reply @optipiwik,

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.

Let me know if this is a good explanation :slightly_smiling_face:

Hello Piotrek,

Thanks for your help :slight_smile:

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:

Thanks a lot!

It looks fine and should work. Keep in mind, that our recommendation is to place it right after the <body> tag. Nevertheless, head also works.