I use piwik analytics to track the visitors to my website. I recently created a blog on WordPress and wanted to added the same tracking code that I use on the plain HTML webpage. How can I added the tracking script in the php in order to track my blog visitors?


  • This plugin helps to include tracking-codes (not only for Piwik, but also Google Analytics etc).
    – user31458
    Apr 13 '13 at 20:08

Add the tracking code to one of your theme files, most likely footer.php.

The easiest way to do this is to go to your admin panel and go to Appearance > Editor, and on the right side, find the entry for Footer (footer.php), and then insert the code right before the closing </body> tag. Update the file by clicking the button below the text box, and you should be good!

  • Thank you, I was adding it to my templates but the footer worked much better! (I'd give you an upvote but alas not enough rep!)
    – Nick
    Aug 15 '11 at 12:56
  • No problem, glad it worked!
    – Joshua
    Aug 16 '11 at 1:04

You'll find Step by step instruction on how to install Piwik on the Wordpress site here.

  • 1
    +1, but an answer should be more than a link. Please read a bit in the FAQ to get a better feeling how this site works. Thanks.
    – kaiser
    Oct 8 '12 at 8:37
  • 1
    The external website is about installing Piwik via Cpanel ... so most of the article is not related to the original question. @wpboss ... its ok to answer a question and reference an article on your own website, but don't over do the linkbaiting / SEO
    – Damien
    Oct 8 '12 at 8:53
  • Link returns “Server not found” – that's why it should be more than a link.
    – Volker E.
    Mar 30 '18 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.