Have you ever wanted to filter out yourself or your office from your site’s Google Analytics? Or, have you ever wanted to make modifications to the data as it comes into Google Analytics? If so, using filters are a great way to do that!
What Are Views?
If you have already set up Google Analytics, you may have noticed that you were viewing reports in a view called “All Website Data” or similar. This is the default “view” that is set up when you create a new property. Each view is a different set of data that was sent into Google Analytics for the property.
When your site sends data to Google Analytics for a property, it will look through all your views to see which views to add the data to. Right now, you may just have the “All Website Data” view which, by default, will receive all data from your site. This is a great place to start.
However, there may be things you want to remove from the data. For example, if you have a dedicated desktop computer, you may want to remove all of your interactions with your own site from the data. You may also want to remove spam and bots from the data too.
Since views can also have different permissions, I have seen some people set up views with specific limited data and give some users only access to that view. One example may be a salesperson who only needs to focus on data relating to certain pages and needs to set up goals that are different than the main view’s goals.
Setting Up Your First View
Before you begin with views and filters, the first thing to know is that you will never want to modify the “All Website Data” view. Data cannot be added to a view retroactively. So, if you accidentally set up a view to where it doesn’t store any data for your site, you will not be able to get the data back. So, by keeping the “All Website Data” view as-is, you know you will also have all the data to go back to.
So, most people set up a second view. Some people call it “Real View”. Some call it “Master View”. For most of my sites, I just call it “Without me and spam”.
Keep in mind that the only data in a view is what was collected after it was created. So, none of your data already in Google Analytics will appear in a view which is why you want to set up your first view as soon as possible.
To set up your new view, go to the Admin area and select your account and property. On the far right, will be the view settings for your default view. You can click the “Create View” button to create your new view.
Name your new view, change the timezone if needed, and then click “Create View”. If you are not already, go back to the Admin area and click the dropdown on the far right under “View” to select your new view. Make sure to not make changes to the “All Web Site Data” view.
The first thing that you will want to do is click “View Settings” and scroll down to the “Bot Filtering” option. Go ahead and turn that option on.
Note: If you want to track what people search for on your site, be sure to turn on “Site search Tracking” while you are in the View Settings. In WordPress, the default query parameter to enter is s. If you are not using WordPress, you will want to search or ask the support team of the software you are using to determine the query parameter.
Once you have turned on bot filtering, go ahead and click Save. Great! You have your first custom view set up. Now, let’s add your first filter.
Adding A Filter
If you are not already, go back to the Admin area and click the dropdown on the far right under “View” to select your new view. Make sure to not make changes to the “All Web Site Data” view. This time, click on “Filters”.
Filters are how we can tell Google Analytics what to include, exclude, or modify in this view. We can use filters to exclude IP addresses (such as your desktop computer), locations, certain referrals, certain parts of your site, and much more. Additionally, you can use filters to exclude data that you know is spam.
For example, there was an issue in 2018 where a lot of bots were sending in fake information into certain fields within Google Analytics. The easiest way to get rid of it was by using a filter.
Lastly, you can use filters to modify data as it comes into Google Analytics. Something to remember in Google Analytics is that everything is case sensitive. So, example.com/thankyou is different than example.com/THANKYOU. Also, if you are using campaigns, spring-sale-2019 is different than SPRING-SALE-2019.
As such, Google Analytics will report these as two different things. So, we could use a filter to lowercase or uppercase everything before it gets entered to ensure Google Analytics counts these things as one thing.
To get started with our first filter, click “Add Filter”.
After you create some filters, you can re-use them in other views and other properties to make things easy. Since we are creating our first one, we will click “Create New Filter”. Next, enter in your filter’s name. Be descriptive of what the filter is doing as you may have many filters in the future.
Google Analytics has many of the common filters as “Predefined”. There are many more things you can do with filters by using “Custom” but, for now, we will use Predefined. Select “Exclude” from the first dropdown and “traffic from the IP addresses” for the second dropdown. Finally, select “that are equal to” in the third dropdown.
Now, open up a search engine, such as Google, and search “What’s My IP?”. Most search engines will list your IP for you. Then, copy that IP address into the “IP address” field for your filter.
Depending on which type of filter you are setting up, Google Analytics may tell you how many data points would be filtered out by the filter in the “Filter Verification” section to help you verify that you set it up right.
Once you are ready, click “Save”.
The last thing to keep in mind before you add more filters is that these are applied one-at-a-time in the order you add them. For most sites, this will not be a problem. However, there may be times you want to have filters build upon each other. After you add multiple filters, you will see a new “Assign Filter Order” button appear.
If you click this, you can re-order the filters to achieve the results you need.