Dynamic/variable tracking url?

(Frank) #1

We want to track our websphere portal with Piwik

The portal is reachable via Internet and Intranet with “different” URL since some office locations don´t have internet access.
Most people reach the portal via internet e.g. “portal.xyz.com” locations without internet access open “portal.intranet.xyz.com

So if our piwik server is located in the internet the locations without internet access can´t reach the server and the access won´t be tracked.
Is it possible to have a “variable” tracking code based on the URL of the access?

Like portal access via internet will be tracked on piwik.xyz.com and intranet access will be tracked on piwik.intranet.xyz.com ?

(Frank) #2

I guess I found a way… not yet tested…

replacing :

var u=((“https:” == document.location.protocol) ? “https” : “http”) + “://piwik.xyz.com/”;

var x=window.location.hostname.replace(‘portal.’,‘piwik.’)
var u=((“https:” == document.location.protocol) ? “https” : “http”) + “://”+(x);

should redirect to piwik.xyz.com or piwik.intranet.xyz.com