homepage Welcome to WebmasterWorld Guest from 50.16.130.188
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / WebmasterWorld / Website Analytics - Tracking and Logging
Forum Library, Charter, Moderators: Receptional & mademetop

Website Analytics - Tracking and Logging Forum

    
Google Analytics: how to exclude certain users from stats
Some questions
g1smd




msg:3593085
 3:57 pm on Mar 6, 2008 (gmt 0)

I have a site that I am developing for a local business. It is a mainly static site, but the headers, breadcrumbs, navigation, and footers, are all loaded from include files. This makes it easy to add or change common content, and PHP coding can make some of those features dynamic.

New content (only one or two pages per month, once the initial 100 pages are done) is initially uploaded into a development folder. After it has been checked by all the people that need to see it, it gets moved to the live part of the site.

Google analytics is used on the site, and the GA code is suppressed from the page if the page is in the development folder. We only want to track users and pageviews on the live "public" part of the site.

A recent requirement is that we now want to exclude all the site owners and any developers from being counted as visitors even on the live part of the site as they are seriously skewing the results.

The way that GA works now, is that Google wants to potentially track everything but thay let you add filters to exclude some data from being counted.

In the current situation, no-one has a static IP address, so the "exclude by IP method" is of no use.

I have tried the "set an ignore cookie" method, coupled with a filter to remove those users from the count, but that still relies on the users visiting the special page used to set that cookie. The special page still shows in the stats, for that first visit, as well.

There is also a danger that other people will find, and visit, the "special page" and be fed the "ignore_me" cookie, when in fact they are real visitors that we actually did want to count.

What I would like to do, is feed the "ignore_me" cookie to anyone reading any of the pages in the development folder (which is password protected) so that when they later browse the real site they are not included in the stats.

That way, they don't need to visit any "special page" to pick up that cookie. They are already pre-qualified as being one of the "site owners" by having read some pages in the password protected development area, so only those people could ever get the cookie.

The problem is, is that if I add the GA "ignore_me" code to the pages in the development area, Google will be able to "see" those URLs, will track them, and they will show in the reports. I want it to be as if those pages don't exist at all, as far as Google is concerned.

It appears that in the setting of the "ignore_me" cookie, you need the rest of the GA code to be loaded first. That code then automatically tracks the user as having been on that page. The cookie for ignored users looks like this:

__utmv:345612345.ignore_me

with a matching "custom filter" using "exclude" and "ignore_me" to suppress those views from the stats.

.

So, I think my questions are this:

- Is the cookie always called "__utmv"?

- Is the seven-digit number static, and is it associated with the site, the GA account, or with the user?

- Can I somehow set that cookie and the right value for it, without calling the GA code that will track the user on that page?

.

Some clarification. There are three things you can currently do:

- omit the GA code from the page: users will not be tracked.

- add the GA code to the page and users will be tracked.

- add the GA code as above, and an extra line like:

<body onLoad="java scr ipt:pageTracker._setVar('ignore_me');">

so that subsequent page views by that user can be excluded from the stats by the matching filter set up via the GA control panel. However, those page views are still transmitted to Google, appear in the "raw" stats, and have to excluded using a "custom filter".

What I would like, is an extra function: a way to force the "ignore_me" cookie, without Google tracking that page view AT ALL.

Can I somehow "fake" the right cookie name and cookie data onto the user's machine, while they browse the development folder, to make this work, without having to load up the regular GA code on the page first?

 

ewanfisher




msg:3593977
 11:35 am on Mar 7, 2008 (gmt 0)

Hi g1smd.

I may be missing something here but is it not possible to:

- Add the 'ignore_me' cookie setting code to all pages in the 'development folder'.

- Create a filter to exclude all visitors that have this cookie.

- Create a custom filter to exclude all visits to the 'development folder'. eg: "^/development_folder/"

This would then not count anyone who had the 'ignore_me' cookie, plus any visits to the development folder.

g1smd




msg:3594326
 6:11 pm on Mar 7, 2008 (gmt 0)

I guess it would, but I would rather not have the data going into the system at all.

There is also a separate development server, on localhost, as an aliased subdomain, where none of the pages (even copies of the live ones) should ever be tracked.

Why do I have to track it all and then filter some of it out, rather than just not track it at all?

When adding new URLs in development I have to be sure there is a corresponding filter in GA set to ignore those.

I see me forgetting something at some time in the future.

I'd rather just have two types of GA code on the site, dynamically selected in my ga.code.inc include.

One says "track me" and the data is sent to GA for recording (and then filtered/excluded for just those people who have the "exclude" cookie set).

The other says "bosh, you're looking at 'this' page so you must be associated with 'this' site, so you need 'this' cookie to take you out of the equation for all future page views (and don't even track you've been 'here' looking at 'this' page at all)".

g1smd




msg:3598288
 10:52 am on Mar 12, 2008 (gmt 0)

Hmm. I only ask one question for every 1000 answers.

Guess that I ask questions that are "too difficult"?

g1smd




msg:3603625
 2:45 am on Mar 18, 2008 (gmt 0)

My questions are this:

- Is the cookie always called "__utmv"?

- Is the seven-digit number static, and is it associated with the site, the GA account, or with the user?

- Can I somehow set that cookie and the right value for it, without calling the GA code that will track the user on that page?

physics




msg:3606578
 6:06 pm on Mar 20, 2008 (gmt 0)

If you used some PHP it wouldn't be too hard to do something like not display the GA code if the url matched "development" (or whatever uniquely identifies your dev urls).
I know that doesn't answer your question but thought I'd throw it out there.

g1smd




msg:3608375
 11:06 am on Mar 23, 2008 (gmt 0)

Yes, I do use PHP *a lot*, and I can get it to not have any GA code on certain pages. That bit was easy.

I need to go one step further.

You can set an "ignore user" cookie and matching filter, so that site owners and devs are never tracked on the live site.

Google suggests using a body {onload} event on a "special" and "secret" page that you get your site owners and devs to visit if you want them to be excluded from the stats. You have to be very careful that search engines never find and index that page. You need meta noindex as a bare minimum; better yet, have it behind a password.

You set up a custom filter in GA to exclude the actions of those users. You then end up with two profiles. One has the "raw data" and the other has the "filtered data". The "raw data" shows all visits, by all people, to all pages.

That works, in that the "filtered data" option shows the right results.

However, the visits to the page that set that cookie are still logged and tracked by Google.

They still appear in the raw (unfiltered) data. I don't want those page views to show anywhere at all, not even in the "raw data".

It is also proving difficult to get everyone to actually visit that "special" page and pick up the "ignore me" cookie.

What I now want to do is something very slightly different.

I want to force that "ignore me" cookie on anyone who visits any of the /dev/ or /test/ or dev.domain.com (which are all password protected) or localhost URLs. I want to set it automatically.

I can do that by using the body {onload} event on all of those pages, as suggested by Google, but the page views for those pages are still logged into the "raw data" collection.

The additional step is that I don't want any of those URLs to be tracked, recorded, or logged *at all*. That is, I just want to feed the "ignore me" cookie to the user, and not run any of the other bits of ga.js, for those users viewing those pages.

I have got part way there.

If I dynamically omit the line:
pageTracker._trackPageview();
then the page view is not tracked, and no user data is collected.

The only flaw is that the *visit* count is still incremented by one. Nothing else is recorded into the raw data.

That is 90% of the way there for what I actually want to do.

g1smd




msg:3608422
 1:21 pm on Mar 23, 2008 (gmt 0)

I guess this would hide the real URLs for the pages that were viewed:

<script type="text/javas cript">
var pageTracker = _gat._getTracker("UA-12345-1");
pageTracker._initData();
pageTracker._trackPageview("/null");
</script>

That's many shades better than recording everything, but still not quite enough towards being "invisible".

g1smd




msg:3608580
 3:59 pm on Mar 23, 2008 (gmt 0)

I guess this would hide the real URLs for the pages that were viewed:

<script type="text/java script">
var pageTracker = _gat._getTracker("UA-12345-1");
pageTracker._initData();
pageTracker._trackPageview("/null");
</script>

That's many shades better than recording everything, but still not quite enough towards being "invisible".

That code would be used on pages that should not be tracked, and which need to feed the "ignore me" cookie to users via this extra code:

<body onLoad="java script:pageTracker._setVar('ignore_me');">

The result would be that all pages in the /dev/ and /test/ folders and everythig on dev.domain.com would show up as if it were a page at domain.com/null or dev.domain.com/null that had been viewed.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Website Analytics - Tracking and Logging
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved