Removing my local visits from Google Analytics

I want my own visits not to appear in Google Analytics, and for this I added a test html page on my website. The idea is that I would hit this page once, and GA would not have to count on any of my visits in analytics (by setting opt_scope to _setCustomVar to “visitor”). Below is a snippet of my test html code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

        

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'xyz']);
    _gaq.push(['_setCustomVar', 'myvisits', 'myvisits', 1]);
    _gaq.push(['_trackPageview']);        

    (function () {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();

And now, in my Analytics, I set the following settings:

Filter Name: Myvisits
Filter Type: Custom filter
             Exclude
Filter Field: User Defined
Filter pattern: myvisits
Case sensitive: No

Is there any way to check if my customvar passed in GA. I tried to examine the query parameters for __utm.gif anf I could not see the variable myvisits passed. Here are the request details

http://www.google-analytics.com/__utm.gif?utmwv=4.8.9&utmn=485610273&utmhn=www.example.com&utmcs=ISO-8859-1&utmsr=1173x733&utmsc=24-bit&utmul=en-us&utmje=0&utmfl=10.1%20r85&utmhid=2133980375&utmr=-&utmp=%2Fplain.htm&utmac=xyz&utmcc=__utma%3D14266660.362063006.1299003679.1299003679.1299003679.1%3B%2B__utmz%3D14266660.1299003679.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B&utmu=q

Am I doing something wrong?

+3
source share
3

setCustomVar. :

_gaq.push(['_setCustomVar', 1, 'myvisits', 'myvisits', 1]);
+3

. Google . , , , , cookie, IP-. cookie, , , , . ip, .

,

  • , .
  • " ".
  • , .
  • "" → ip address → , ...
  • .

, , , .

+2

Your script sets CustomVar while the filter is based on UserDefinedValue. Although they sound the same, they are different.

Filtering on CustomVar can only be done by defining AdvancedSegments, and not in profile filters.

Using UserDefinedValue is not recommended:

  • condemned
  • sets value for next visit, not current

=> more reliable for filtering by IP, for example

+1
source

Source: https://habr.com/ru/post/1795573/


All Articles