WordPress.org

Ready to get started?Download WordPress

Forums

WP-Piwik
[resolved] Tracking code has bare IPv6 address (5 posts)

  1. ripencc
    Member
    Posted 1 year ago #

    Hello,

    We are using WP-Piwik on several WordPress sites, and recently noticed the stats had stopped completely.

    Investigating, it turns out that after the last update (0.9.8), WP-Piwik now generates tracking code that has the host IPv6 address instead of the HOSTNAME. Piwik itself has no problem with this, it generates proper code. We found no way of fixing this in the settings.

    The problem comes up likely because the host has both IPv4 and IPv6 addresses, but no IPv6 reverse (which likely would have hidden it). But it causes problems since it bypasses all VHost configuration now.

    Problem tracking code:

    <!-- Piwik -->
    <script type="text/javascript">
    var pkBaseURL = (("https:" == document.location.protocol) ? "https://2001:67c:2e8:xxxxxx/piwik/" : "http://2001:67c:2e8:xxxxxxxxx/piwik/");
    document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
    </script><script type="text/javascript">
    try {
    var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 8);
    piwikTracker.trackPageView();
    piwikTracker.enableLinkTracking();
    } catch( err ) {}
    </script><noscript><p><img src="http://2001:67c:2e8:xxxxxxxx/piwik/piwik.php?idsite=8" style="border:0" alt="" /></p></noscript>
    <!-- End Piwik Tracking Code -->

    Please advise.

    Thank you,
    Mihnea

    http://wordpress.org/extend/plugins/wp-piwik/

  2. braekling
    Member
    Plugin Author

    Posted 1 year ago #

    WP-Piwik gets its tracking code from Piwik itself.

    Maybe the trusted hostname is not configured properly?
    See http://piwik.org/faq/troubleshooting/#faq_171
    and http://wordpress.org/support/topic/wp-piwik-changes-link-to-ip?replies=14

  3. ripencc
    Member
    Posted 1 year ago #

    Piwik was correctly configured (and the code was correct there), however within WP-Piwik we were using an alias of the Piwik server to talk to it -- i.e. "machine.example.com" instead of "piwik.example.com". This used to work correctly until recently, but it is possible more stringent security controls now restrict the behaviour.

    Changing the hostname to the "canonical" one (piwik.example.com) used within Piwik fixed the issue. It is still weird that the IPv6 address was showing up there, it may warrant some investigation (a hostname error instead of that behaviour would probably push people in the right direction).

    Thanks,
    Mihnea

  4. braekling
    Member
    Plugin Author

    Posted 1 year ago #

    Nice to hear that it's working now!

    This issue is caused by Piwik itself - WP-Piwik gets a tracking code and
    no error message, so WP-Piwik supposes the tracking code is valid. If you don't use the API (like WP-Piwik) but open machine.example.com (instead of piwik.example.com) directly using your browser, you can see a hostname error message returned by Piwik.

    Btw: You can disable the trusted hostname feature if you need to use the alias. Or you can use the Piwik proxy skript to hide the "canonical" hostname (be careful: in this case disabling cookies won't work anymore). See the Piwik documentation or FAQ regarding these topics.

  5. ripencc
    Member
    Posted 1 year ago #

    Thanks for the extra information, indeed disabling the trusted hostname feature seems like the best bet. For now we just changed all websites to point to the canonical name, if we ever have a need to change that we'll just disable the "trusted hostname".

    Regards,
    Mihnea

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.