Title: tracking code not inserting automatically
Last modified: August 21, 2016

---

# tracking code not inserting automatically

 *  Resolved [chadwick37](https://wordpress.org/support/users/chadwick37/)
 * (@chadwick37)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/tracking-code-not-inserting-automatically/)
 * I’m setting up wp-piwik in a multi-site environment. Everything seems to be set
   up correctly but the tracking code will not insert automatically. I’ve been seeing
   this error in the logs and I’m wondering if this is the cause:
 * PHP Notice: Undefined index: track_cdnurl in /var/www/…/public_html/content/plugins/
   wp-piwik/classes/WP_Piwik_Settings.php on line 109
 * Is there a fix for this error and could it be preventing the insertion of the
   tracking code?
 * Thanks!
 * [https://wordpress.org/plugins/wp-piwik/](https://wordpress.org/plugins/wp-piwik/)

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

 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/tracking-code-not-inserting-automatically/#post-5152479)
 * This notice (It’s not an error, but of course it’s not nice to get notices. It
   won’t occur anymore in WP-Piwik 1.0.) does not affect the insertion.
 * Are you using WP-Piwik in network mode?
    Is adding the tracking code enabled?
   Did you logout to check if the tracking code is added (remember the tracking 
   filter at the bottom of the tracking settings page)? Does your theme use “wp_footer()”
   and/or “wp_header()” in its footer/header files?
 *  Thread Starter [chadwick37](https://wordpress.org/support/users/chadwick37/)
 * (@chadwick37)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/tracking-code-not-inserting-automatically/#post-5152513)
 * Thanks for the response. Yes it is in network mode and adding the tracking code
   is enabled. However, I was not logged out when checking to see if the tracking
   code was inserted. When I log out I do see the tracking code is inserted. In 
   the WP-Piwik settings I do not have any of the roles checked for the tracking
   filter. It is important that user traffic is collected in both the front end 
   and the in the admin so I don’t want to disable tracking for any user roles. 
   I also have ‘Track Admin Pages’ enabled. The fact that the tracking code isn’t
   being inserted while logged in means users are not being tracked? How about in
   the admin? I don’t see the tracking code there either.
 * Thanks,
    Chad
 *  Thread Starter [chadwick37](https://wordpress.org/support/users/chadwick37/)
 * (@chadwick37)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/tracking-code-not-inserting-automatically/#post-5152686)
 * Do you have any feedback as to why admin pages are not being tracked even with
   Track Admin Pages enabled and logged in admins are not being tracked even though
   I’m not filtering any roles?
 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/tracking-code-not-inserting-automatically/#post-5152713)
 * Seems to be a bug related to tracking filters in multisite networks. Logged in
   users will be tracked on all sites but their own sites.
 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/tracking-code-not-inserting-automatically/#post-5152730)
 * I have to get deeper in this and have to decide if I release one more interim
   solution or if it makes more sense to fix it while working on the 1.0 beta.
 * Anyone else effected on this issue (needs to track logged in users on their own
   page and admin area in a multisite network)?
 * chadwick37, is it okay to wait for 1.0 beta? (I’m working on this release currently.)
 *  [jschelle](https://wordpress.org/support/users/jschelle/)
 * (@jschelle)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/tracking-code-not-inserting-automatically/#post-5152748)
 * I experienced the same problem. In addition there exist a strange line of code
   in the tracking code preview:
 *     ```
       ...
          var ucdn=(('https:' == document.location.protocol) ? 'https://<b>Notice</b>:  Undefined index: track_cdnurl in <b>/var/www/virtual/antiakw/stop-tihange/wp-content/plugins/wp-piwik/classes/WP_Piwik_Settings.php</b> on line <b>109</b>/' : 'http://<b>Notice</b>:  Undefined index: track_cdnurl in <b>/var/www/virtual/antiakw/stop-tihange/wp-content/plugins/wp-piwik/classes/WP_Piwik_Settings.php</b> on line <b>109</b>/');
       ...
       ```
   
 * Thanks,
    Joerg
 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/tracking-code-not-inserting-automatically/#post-5152749)
 * Just save your tracking settings once, then the notice should disappear. Looks
   like an update was not performed well.
 *  [jschelle](https://wordpress.org/support/users/jschelle/)
 * (@jschelle)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/tracking-code-not-inserting-automatically/#post-5152750)
 * Does not work. I already deleted the whole plugin and installed it again. Same
   result.
 * Thanks for your quick reply
 * Joerg
 *  [jschelle](https://wordpress.org/support/users/jschelle/)
 * (@jschelle)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/tracking-code-not-inserting-automatically/#post-5152751)
 * In addition the line of code contains the error message from chadwick37 in the
   first post “Undefined index: track_cdnurl in … WP_Piwik_Settings.php</b> on line
   <b>109</b>”.
 * Thx,
 * Joerg
 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/tracking-code-not-inserting-automatically/#post-5152760)
 * It’s just a notice, so if you disabled your debug mode, the tracking code should
   be fine. Don’t worry about this. But of course I will remove this notice in the
   next update. This notice is idependent from the issue itself (no tracking of 
   logged-in users on their own blog/in their own admin area in network mode).
 * If you want to use WordPress in debug mode (not recommended, but for developing
   reasons etc.), you can use this hotfix:
 * Open `classes/WP_Piwik_Settings.php`.
 * Go to line 39:
    `'track_cdnurlssl' => '', 'track_noscript' => false,
 * Extend:
    `'track_cdnurlssl' => '', 'track_track_cdnurl' => '', 'track_noscript'
   => false,
 *  [mcnesium](https://wordpress.org/support/users/mcnesium/)
 * (@mcnesium)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/tracking-code-not-inserting-automatically/#post-5152808)
 * My brand new WP-Piwik did not track anything either. Then I found that in the
   Tracking settings at “CDN URL:” there was an entry with exactly this weird message
   named above set in the first input field. I just deleted that out, and voila…
   its tracking. Just to let anyone know, who came here via search engines.
 *  [Devon Ostendorf](https://wordpress.org/support/users/devonostendorf/)
 * (@devonostendorf)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/tracking-code-not-inserting-automatically/#post-5152810)
 * I had an identical experience to mcnesium’s.
 * I am using WP 4.1 and Piwik 2.9.1 and testing locally (with debug mode on). When
   I ran into the same “Undefined index: track_cdnurl..” error, I blanked out the“
   [http://&#8221](http://&#8221); input field for “CDN URL” on the Tracking page
   in the plugin Settings. Once I saved the change and reloaded a page on my site,
   the visit was logged by Piwik.
 * Thanks much for the plugin – you might consider adding a note about this particular
   issue to the FAQ page to minimize the number of redundant notes (like mine!) 
   you get about this. 🙂 Or maybe your time is better spent working on v 1.0 as
   it sounds like you’re in the thick of..

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

The topic ‘tracking code not inserting automatically’ 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/)

 * 12 replies
 * 5 participants
 * Last reply from: [Devon Ostendorf](https://wordpress.org/support/users/devonostendorf/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/tracking-code-not-inserting-automatically/#post-5152810)
 * Status: resolved