Support » Plugin: WP-Matomo (WP-Piwik) » Tracking code has bare IPv6 address

  • Resolved ripencc



    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);
    } 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,

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author braekling


    WP-Piwik gets its tracking code from Piwik itself.

    Maybe the trusted hostname is not configured properly?

    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. “” instead of “”. 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 ( 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).


    Plugin Author braekling


    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 (instead of 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.

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


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Tracking code has bare IPv6 address’ is closed to new replies.