Title: [Plugin: WP-Piwik] Uncaught ReferenceError: piwikTracker is not defined
Last modified: August 20, 2016

---

# [Plugin: WP-Piwik] Uncaught ReferenceError: piwikTracker is not defined

 *  Resolved [alxvallejo](https://wordpress.org/support/users/alxvallejo/)
 * (@alxvallejo)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-wp-piwik-uncaught-referenceerror-piwiktracker-is-not-defined/)
 * I have a custom tracking JavaScript file that tags certain DOM elements’ clicks
   and records them via the piwikTracker function call.
 * The problem is that the WP scripts are loaded in the header and the piwik script
   is apparently loaded in the footer.
 * I specified that my JavaScript wait for the ready handler but my script still
   does not load when I enqueue the script with a dependency on the script **‘wp-
   piwik’**.
 * If I remove the dependency then I get this error in Chrome.
 * So am I even loading piwik? How do I load the tracking script on each page (I
   though it was by default)? and what is the alias of the script so I can specify
   the dependency?
 * If the piwik tracking script is not being loaded, would I have to copy and paste
   Piwik’s tracking code into it’s own script and load that like I would any other
   JavaScript file? I figured the plugin handled that for me:
 * [http://piwik.org/docs/javascript-tracking/#toc-where-can-i-find-the-piwik-tracking-code](http://piwik.org/docs/javascript-tracking/#toc-where-can-i-find-the-piwik-tracking-code)
 * [http://wordpress.org/extend/plugins/wp-piwik/](http://wordpress.org/extend/plugins/wp-piwik/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-wp-piwik-uncaught-referenceerror-piwiktracker-is-not-defined/#post-2902057)
 * The script wp-piwik does not contain the tracking code. Your tracking code is
   directly posted by wp_footer to your page’s source.
 * If you like to use an individual tracking code, disabled WP-Piwik’s “add tracking
   code” option and include your own code in your footer file.
 * To get help on Piwik and its tracking code, please visit the Piwk forums at [http://forum.piwik.org](http://forum.piwik.org)
 *  Thread Starter [alxvallejo](https://wordpress.org/support/users/alxvallejo/)
 * (@alxvallejo)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-wp-piwik-uncaught-referenceerror-piwiktracker-is-not-defined/#post-2902140)
 * Hi braekling,
    The tracking code itself is working properly.
 * I actually solved the issue by loading the custom tracking scripts in my own 
   plugin instead of functions.php.
 * I’m not sure if the default priority settings were in play or not (I left them
   to default) but it seemed to solve the issue. Perhaps loading any custom tracking
   in functions.php that calls for piwikTracker.js is loaded before Piwik, despite
   my javascript calling the functions only when the page is in ready state.
 * Anyways, thanks for the reply!
    -Alex
 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-wp-piwik-uncaught-referenceerror-piwiktracker-is-not-defined/#post-2902142)
 * Hi alxvallejo,
 * thank you for posting your solution! I hope this will also help other users dealing
   with this issue.
 * Best regards
    André

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Plugin: WP-Piwik] Uncaught ReferenceError: piwikTracker is not defined’
is closed to new replies.

 * ![](https://ps.w.org/wp-piwik/assets/icon-256x256.png?rev=3529668)
 * [Connect Matomo - Analytics Dashboard for WordPress](https://wordpress.org/plugins/wp-piwik/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-piwik/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-piwik/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-piwik/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-piwik/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-piwik/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [braekling](https://wordpress.org/support/users/braekling/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-wp-piwik-uncaught-referenceerror-piwiktracker-is-not-defined/#post-2902142)
 * Status: resolved