Welcome to WebmasterWorld Guest from 54.226.146.15

Forum Moderators: DixonJones & mademetop

Message Too Old, No Replies

How To Disable Google Analytics for a Single Page

     

Yinka

3:05 pm on Sep 6, 2012 (gmt 0)

5+ Year Member



I need to disable Google Analytics for a single page, how can I do this? The Google Analytics code is installed on the website via include files, so instead of creating a separate header/footer file for this single page I'd like to disable Google Analytics from tracking this page. I'm thinking some reg ex code in the site profile would do the trick, but I do not know reg ex enough to write the expression. If you know how to write the expression or another way to disable GA for the single page then please share? Any help is greatly appreciated. Thanks in advance.

jigarpandya

5:46 am on Oct 3, 2012 (gmt 0)



Its simple, Just remove the Track code from their particular page..

Yinka

3:27 pm on Oct 3, 2012 (gmt 0)

5+ Year Member



Thanks for the reply. However the page is dynamic and the code is set at load time by a universal include file. My colleague actually found a way to do it via Google Analytics admin console by entering info into "Exclude URL Query Parameters" and creating a "Filter" to remove the page. Thanks.

jigarpandya

5:29 pm on Jan 9, 2013 (gmt 0)



I found the answer for you at developers dot google com.. It may have the answer for you..

Disabling Tracking

In some cases, it may be necessary to disable the Google Analytics tracking code on a page without having to remove the code snippet. For example, you might do this if your site's privacy policy includes the ability for a visitor to opt-out of Google Analytics tracking.

The ga.js tracking snippet now includes a window property that, when set to true, disables the tracking snippet from sending data to Google Analytics. When Google Analytics attempts to set a cookie or send data back to the Google Analytics servers, it will check for whether this property is set to true. If it is, it will have the same effect as if the visitor had the Google Analytics Opt-out Browser Plugin installed .

To disable tracking, set the following window property to true:

window['ga-disable-UA-XXXXXX-Y'] = true;
Where the value UA-XXXXXX-Y corresponds to the web property ID on which you would like to disable tracking.

This window property must be set before the tracking code is called. This property must be set on each page where you want to disable Google Analytics tracking. If the property is not set or set to false then the tracking will work as usual.

So, for example, if your Google Analytics tracking code on a page includes:

_gaq.push['_setAccount', 'UA-123456-1']
And you would like to disable that tracking code from setting cookies or sending data back to Google Analytics, then you use the following code before the tracking code is called:

window['ga-disable-UA-123456-1'] = true;
If you use multiple trackers on a page with multiple web property IDs, you must set the equivalent window['ga-disable-UA-XXXXXX-Y'] variable to true for each web property to completely disable Google Analytics tracking on that page.

Thank you..
Jigar - Ans via Delevopers Dot Google dot com
 

Featured Threads

Hot Threads This Week

Hot Threads This Month