External/internal IP for tracking cookie

I have a Wordpress blog at http://www.systemagnostic.com. On my internal network, the Apache webserver is called “shadowbunt”. Using Piwik has so far shown eight visits the last two weeks, while StatPress statistics also running on the same site shows over 200 separate visits, more in line with number of comments and the Apache access log, so something is definitely off, and I was thinking that perhaps there is something with the external/internal IP mapping.

The address “shadowbunt” is obviously not visible to the outside. I must admit I do not know JS/PHP well enough to know what is being processes in the browser and what is being processed serverside. This is the code Piwik suggests and I currently use:


<!-- Piwik --> 
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://shadowbunt/piwik/" : "http://shadowbunt/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", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://shadowbunt/piwik/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->

The reference to “shadowbunt”, my internal server hostname, does show up in the HTML page source when browsing my Wordpress site, and since the browser cannot reach my web server using an internal address I presume this fails and should be replaced with http://www.systemagnostic.com?

To further complicate things, in my Wordpress installation, any URL not pointing to a page in Wordpress will take you to the home page (Apace rewrite rules), so http://www.systemagnostic.com/piwik points to my Wordpress installation and not Piwik (which was the way I intended it, as I don’t want Piwik open to the world - only accessible from my LAN at http://shadowbunt/piwik). Incidentally, www.systemagnostic.com is an Apache virtualhost.

Anyoone got any pointers here? Should I change the code from “shadowbunt” to “www.systemagnostic.com”, and if so, must systemagnostic.com be accessible to the world?

PS: The link on the Piwik FAQ to configuration examples are broken

Solved my own problem. Quickly summarized: changed all internal IP references to the external DNS equivalent, created a RewriteCond in Wordpress’ htaccess file that made Wordpress stop redirecting the Pwiki page, and updated the trusted host in Piwik to my external DNS name, and that was it. Problem solved :slight_smile: