简体   繁体   中英

How to Hide Your own Visits to Your Site From Google Analytics?

Google Analytics Problem

I am building my website and for that purpose, i have to visite my website several time. When i make some changes to the code or i upload some new content.

But the problem i am facing is that the google analytics is continuously tracking my own visits and displaying relatively greater number of visitors.

Kindly somebody helps me to overcome this google analytics view issue. So that i can easily hide my visits from google analytics effectively.

Inside Google Analytics you can easily make some changes and block your own visits by adding your IP address. If you don't know your IP address visit the following sites to find it- https://whatismyipaddress.com/ and https://www.whatismyip.com/

Your IP address will look like this: 105.57.186.42 (example). Now that you know your IP address please note it down.

Login to Your Google Analytics Dashboard and select your website property.

Now select Admin from the left side pane. Select the account where you don't want the visits to be tracked. Now, select All Filters. Then click on ADD FILTER.

Enter any filter name, for example, I have given "Exclude Own Visits".

Under Filter Type, by default Predefined is selected. Leave it as it is.

Under select filter type select Exclude.

Under select source or destination select traffic from the IP addresses.

Under Select expression select that are equal to.

Now enter your IP address which you don't Google Analytics to track.

Then under Apply Filter to Views select All Web Site Data and click on Add.

To my knowledge, there are three methods to hide self-visits from google analytics.

1. Google Analytics, Filter IP Address

In this method, we will add a filter to the google analytics dashboard. We use the IP address to filter out the traffic. For this purpose, follow these steps.

Step 1: Open Google Analytics and go to the admin menu at the left bottom of the screen.

Step 2: If you are using Universal Analytics View, then there will be three views, ie Account, Property, and View. The first and last view has All Filters options, navigate to any of these.

Step 3: Open the All Filters menu and click the Add Filter button, this will open a new form.

Step 4: Fill out the form fields

  1. Filter Name: Set desired name of the filter, eg exclude traffic.
  2. Filter Type: Select predefined and choose the options as below image. Google Analytics 过滤器 IP 地址的图像
  3. IP Address: Add your IP address in the input field provided to you by your network provider.
  4. Apply Filters To View: Select the view from the list, which you want to exclude
  5. Click Save Congrats, you have added an IP filter.

2. Google Chrome Extension

This method is really simple and easy to configure. Just add this chrome extension and you are all set up. This extension will block google analytics to track your visits.

3. PHP Conditional Statement

This is a really simple method and I myself use it on my website TutsInsider . You have to just follow these steps to get the job done.

Step 1: Go to your theme folder and open the file which contains the Google Analytics tag. We mostly add this code in header.php in WordPress.

Step 2: Scroll to the code line where you have entered the Google analytics script.

Step 3: Wrap this script with the following if statement .

if ( ! is_user_logged_in() ) { 

// Google Analytics Script Goes here

}

You are fine now, as long as you are logged in to WordPress, the page visits won't load the google analytics script. Hence, if the Analytics script is not loaded, Google won't be able to know if someone visited the site.

在 Google 的 WordPress 插件Site Kit 的 Google官方分析中,有一个设置可以从分析中删除所有登录用户或仅删除具有帖子创建功能的用户

As you're using the Site Kit plugin, the default behavior for Google Analytics is to not track logged in users. For that reason all you need to do is to ensure this default configuration remains active, as @Moshe-Gross mentioned. Then when you're working on your site ensure you are logged in with a WP administrator account, so your visits are not tracked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM