Avoid counting local saved files

Hi,

in “Actions”, “Pages” I can see a lot of local saved webpages like “file:/C:/Users/xxx/Desktop/xxx”.

How can I avoid counting theses pages?

Regards
Oliver

Hi Oliver
That might happen because the saved (“test”) pages contain the Piwik tag too, so if you watch them in your browser, they will be counted under the same site ID as your “production” pages.

To avoid that, you can extend the piwik tag if you are familiar with javascript. There is a JS function that gets the URL of the current page. Here is some code that extracts the pathname (ususally the same in all pages of one site, like “h t t p : //mysite.tld/”) and throws away the filename (like “index.htm”):

function pathname()
{    var p = 0;
    var s = window.location.href;
    for (i=0; i<s.length; i++)
    { 
        if (s.substr(i,1)=="/") {p=i} 
    }
    return s.substring(0,p+1);
}

With something like that, you can wrap the piwik tag into something like

if pathname="h t t p ://mysite.url/" {the piwik tag here}

…and then page views are only counted from your production site. Note I write “h t t p:” because this forum software does not like URLs and would otherwise replace it with the word “(extlink)”.

Hope this helps

Cheers,
Burkhard

p.s. to exploit this further, you could use different site IDs depending on the URL. Then on your “test” server (which might well be your own PC) you can play with the way piwik records views, links, downloads and goals, trying which data and page names to send to piwik etc., without tampering your “real” stats.