(a) could tell at runtime if it was running in a test scenario or from the production server
(b) loaded the pixel with a different name depending on (a)
Now I would like to do the same with Piwik: Every webpage to track would include a statement like
and everything else would happen in the js function “usepiwik()” that sits in a js file already loaded. However, I seem to be unable to get that working. My latest attempt was based on code from this forum (see here). Here is the simple version of the function:
The document.write() text shows on the screen so the function is actually being called but the Firefox JS console keeps on telling me “Piwik is not defined”, pointing to the Piwik.getTracker() call.