1
votes

I know there have been similar questions in the past but I have tried many solutions given online to no avail. I am just not able to hide internal traffic for Google Analytics on my Django site.

I am setting the filter from Admin->View->Filters. Have tried Predefined and Custom both with fixed IP as well as a regex pattern. (Yes, I have double checked my IP from whatismyip.com and I am using the right one)

I read somewhere that it takes time for the filters to come into effect, so even waited for 24 hours but I still see a lot of internal traffic.

Google Tag Assistant is also tracking the pages when I access them from internal IP (not sure if its supposed to know about the filters)

Not sure where could I be going wrong.

(I am using reverse proxy but hopefully that wouldn't change anything since the google analytics code is run on the client side)

2
Maybe you use IP anonymization in your tracking code ? Because that is applied before the filters, making them basically useless (unless you discard a whole range of addresses). - Eike Pierstorff
@Elike No I am using exactly the same tracking code that I got after sign up, without tweaking it. - Anupam
You can also adapt this approach from php to python. - J0ANMM

2 Answers

1
votes

Do not use any filter on the default view (called 'All Website Data'). Create a separate view and then create a filter on it. That will work.

(After struggling with it for a few days, this response helped me with the above fix)

0
votes

I struggled with this as well, so here is what I found out.

Note that real time reporting can take up to 2hrs to catch up to and reflect analytics configuration changes such as the addition of filters.

Possible solutions

1) As suggested in the other answer, leave the default view as default and create an additional view for the filters:

The default view collects all traffic. You need to create a new view for which you can apply your filter. Check out item 3 here https://support.google.com/analytics/answer/1009618?hl=en

How to add a new view: https://support.google.com/analytics/answer/1009714?hl=en

2) Filter IP v6, not v4:

Exclude the ipv6 address as mentioned in above post. This is the one that "what is my ip address" returns. It's not the ipv4 syntax (xxx.xxx.xxx.xxx) However, I have noticed that wired machines that stay connected seem to keep the same ipv6 IP (the 31 digit sequence), however wireless accounts (mobile phones, tablets) tend to be dynamic. However, as posted above if you use just the first 15 digits of the sequence and use the "begins with" filter type, it will block the devices using the same shared router (ie. internet router in your home)

About filtering only the first 15 digits:

I think it is meant to filter the first four blocks, so if your IPv6 looks like 2601:191:c001:2f9:5c5a:1c20:61b6:675a, then filter IP that begins with 2601:191:c001:2f9:.


Information found here.