How To Stop Referral Spam In Google Analytics
Now that you know which are ghost spam and which are crawler spam we will create a Ghost Spam filter in GA.
Step 1. Sign-in to your GA account, if not already.
Step 2. At the top menu click on “Reporting”.
Step 3. In the left-hand sidebar click on “Audience”.
Step 4. Then click on “Technology” and then “Network”.
Step 5. Now scroll-up to the calendar at the top right and enter the dates from when you first published your website until the present date.
Step 6. Then scroll back down and click on “Hostname”. By default it is on “Service Provider”. Here you will see all of your domain names or websites and all other hostnames. Some will be legit and some or most will be ghost spam. Even if you see one that says amazon.com inc., this is a fake hostname.
Step 7. Check out the “Bounce Rate” & "Avg. Session Duration” columns on each of these for confirmation that it’s spam.
*Note: Legit hostnames include your own domain name, your subdomains, translate devices, cache services, shopping carts, video services and IP’s. All others that you don’t recognize and have weird hostnames are fake and are spam.
Step 8. Now go back to your document and Copy & Paste all of your valid hostnames. You should have at least one which is your website domain name. I only have one website and no subdomains, translation services, etc. so, I only have included this into my Ghost Spam filter.
What Is A REGEX Pattern?
A REGEX pattern is the filter expression which you need to enter in the GA filter and it would look something like this.
If you only have your valid domain name which is the case with me you will only be including that as the REGEX pattern and it should look something like this.
Notice that "http://www." is not needed in the REGEX pattern and that periods and hyphens need to be preceded by a backslash ( \ ). Also, each different valid domain/hostname needs to be separated by a pipe or bar ( | ) as shown in the first example above.
Step 9. Create your REGEX pattern to be entered into the filter section in GA.