Mobile app version of vmapp.org
Login or Join
Gretchen104

: How to deactivate Piwik locally? Is it possible / how to deactivate the Piwik tracking for the local / dev project copy? It would work with something like <?php if (current environment is

@Gretchen104

Posted in: #Analytics #Matomo

Is it possible / how to deactivate the Piwik tracking for the local / dev project copy?

It would work with something like <?php if (current environment is / is not ...) : ?> print (Piwik code); <?php endif; ?>. But maybe there is a Piwik side "switcher"?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Gretchen104

1 Comments

Sorted by latest first Latest Oldest Best

 

@Cofer257

To my best knowledge there's no such switch. In my opinion, it's also impossible to implement one. The standard Piwik tracking code works with JavaScript that is executed in the visitors browser. Therefore, Piwik does "know" about the visitors computer, but not about the computer/server that served the JavaScript-Code. It can't possibly tell which copy from which computer served the tracking code.

The IMO best solution would be to set some parts of the tracking code variable. You could do something along the lines of, "if development system, track to Piwik website ID 1; if production system, track to ID 2". Another setting you could set variable would be the url of the Piwik installation, to do something along the lines of, "if development system, track to local dev installation of Piwik; if production system, track to prod installation".

That way you can kill two birds with one stone: You can keep the development installation from "polluting" your production data, while you can still see if the tracking data from the development system is generated correctly. With more site ID tracked in Piwik and/or more Piwik installations, as it would fit your needs, you can also handle more environments than "only" development and production, like test, staging etc.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme