Remove visitors of certain pages


#1

Hi!

I searched the forum for a solution but could not find it.

I want to remove automatically all visitors of backend pages of our CMS from beeing counted in the stats.

I thought the best way would be to set the ignore cookie when loading the backend pages. But so far I have not found the way how I could set this cookie automatically when the pages are loaded.

Does somebody know how set the cookie on loading of a page?
Thanks.
Dirk


#2

Hi Dirk,

What software is your CMS and how are you doing your tracking ? Is it a PHP based backend that you have put the primary tracking code in the footer of a shared template maybe. Can you give us an example of the URL pattern you want to exclude ?

Stephen


#3

Take a look at http://piwik.org/faq/how-to/#faq_89 which will show you how to not track specified paths, for example http://www.domain.com/admin/


#4

[quote=IAmNoONESolutions]
Hi Dirk,

What software is your CMS and how are you doing your tracking ? Is it a PHP based backend that you have put the primary tracking code in the footer of a shared template maybe. Can you give us an example of the URL pattern you want to exclude ?

Stephen[/quote]
I am using Joomla. As the text editors and publisher are visiting the frontend page I don’t want to have their visits counted.
Using Google Analytics I added in the backend template


<body onLoad="javascript:pageTracker._setVar('intern');

In the admin area of Google Analytics I then could say that I don’t want to count visits with the value “intern”.

Using the ignore cookie of piwik is working similar but I don’t know how to set that cookie for all people visiting the backend.

Thanks.


#5

Has anybody an idea what I could do?


(Matthieu Aubry) #6

You need to find the variable used in your CMS to define that the current page is a Backend page or not. Then, display the JS code for Piwik inside a IF() that will only display the code when the page is a backend page… But the solution is specific to your CMS / template language used.


#7

I can load any code in the backend only. But which Piwik code should I load in the backend so the backend visitor is not counted automatically?


#8

Just use a conditional if. In your HTML:


//Load piwik JS
...

//Set backend value depending on if admin or not
var frontend_page = true;

if (frontend_page)
{
    try {
        var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 15);
        piwikTracker.trackPageView();
        piwikTracker.enableLinkTracking();
    } catch( err ) {}
}


#9

I want to avoid counting people visiting the frontend when they visited the backend too.

With your code I would not count people in the backend but when those people visit the frontend they get counted still. right?

Do you have a proposal for this as well?


#10

Hi anyone out here who has an idea what I could do?


#11

I am still looking how I can solve this.

Has anybody an idea what I could do?