WordPress.org

Forums

WP-Piwik
[resolved] tracking code not inserting automatically (13 posts)

  1. chadwick37
    Member
    Posted 1 year ago #

    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/

  2. braekling
    Member
    Plugin Author

    Posted 1 year ago #

    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?

  3. chadwick37
    Member
    Posted 1 year ago #

    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

  4. chadwick37
    Member
    Posted 12 months ago #

    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?

  5. braekling
    Member
    Plugin Author

    Posted 11 months ago #

    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.

  6. braekling
    Member
    Plugin Author

    Posted 11 months ago #

    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.)

  7. jschelle
    Member
    Posted 11 months ago #

    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

  8. braekling
    Member
    Plugin Author

    Posted 11 months ago #

    Just save your tracking settings once, then the notice should disappear. Looks like an update was not performed well.

  9. jschelle
    Member
    Posted 11 months ago #

    Does not work. I already deleted the whole plugin and installed it again. Same result.

    Thanks for your quick reply

    Joerg

  10. jschelle
    Member
    Posted 11 months ago #

    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

  11. braekling
    Member
    Plugin Author

    Posted 11 months ago #

    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,

  12. mcnesium
    Member
    Posted 7 months ago #

    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.

  13. Devon Ostendorf
    Member
    Posted 7 months ago #

    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://" 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..

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP-Piwik
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags