How to exclude localhost and dev-sites


#1

As a Piwik beginner, I have a simple question:

I added the piwik-tracing-code to the central template of my website. The website exists in three versions: one local for development, one dev-site on the server for testing purposes and one live site. If I introduce the tracking-code to all websites, I get see hits from all three sites in piwik.

Of course there is the simple solution to insert the tracking code only on the live site. But than I have to deal with different files in all of the three installations, what I dont want.

Is there a possibility to exclude tracking of sites like http://localhost/path and http://dev.mysite.com and see only http://mysite.com ?

Thanks a lot
Nico


(vipsoft) #2

You might be able to use the TrackSiteByUrl plugin, so tracking on the dev/testing sites are logged to a different idsite.


#3

Thank you for the hint. I installed TrackSiteByUrl, added the two other sites as new webpages and activated the plugin.

As soon as I do this, nothing will be recorded by Piwik. If I deactivate the plugin, everything is back to normal.

Are there things I have to configure in the plugin to make it run? Did you find a manual somewhere?

Thanks
Nico


(vipsoft) #4

In Site Management, each site must have unique URLs.

On each web page to be tracked, you still need to use the javascript tracking code. The idsite should be your default.


#5

Hallo Anthon,
I m trying to use the tracksitebyurl plugin, too, but I cant get it work. is there a documentation for it somewhere? Or what does it mean that “idsite should be your default”? Whats the “default” here?
Thanks
Davud


#6

Bump 301 Moved Permanently
Hopefully I don’t get in trouble, for posting to an old thread.


#7

I ran into the same thing and was hoping there was a way to do it inside of the tool so that my past stats could be cleaned up.

Simple fix if you are using PHP is to wrap the Piwik call in an If statement that checks the server… ex:

<? if ($_SERVER['SERVER_NAME'] == "www.chatmap.io") { ?> <? } ?>

Note, we redirect everything to use www. … if you want to check for using both www or not, you could check the position of your domain…

if(strrpos($_SERVER[‘SERVER_NAME’], “chatmap.io”)) { … etc. }