Google Analytics Best Practices That'll Save You From Mess

June 27, 2019

Google Analytics is a really powerful tool. But such power comes with many-many configurable options and features. It’s easy to mess up your data and you won’t notice it until you want to take a look at the reports. But that’s too late… Prevent the mess with these best practices. Don’t worry, they are simple and easy!

Afterall no one likes mess and with these we might make an expert out of you. My goal is to save you from headaches and to provide methods which can save your data and work.

1. Create a raw view

Have you ever messed up a filter or just any kind of settings in your view? I bet you have. That’s why you should always have an original, unfiltered view. It comes in handy when you are troubleshooting. Also, when you mess up something in one of your views, you can fall back to your raw data view. This might save what you have already achieved! It takes very little effort to create this view, so don’t even think about skipping this!

I am pretty sure you are familiar with creating views, but feel free to watch the instructions below:

2. Create a test view

Before making any changes on your master view, you should make sure it won’t mess up your data. That’s why we create a view that’s used for testing. Try out your changes using a test view. Leave it running for a few days and once you can confirm that it’s working properly, go on and make the same changes on your master views.

By now you definitely know how to create a view, but I’ve already recorded this video so here you go:

3. Filter: Lowercase all URLs

Rarely it happens that someone is typing in a URL which can lead to errors like typing in an uppercase character, or even the whole URL is typed in uppercase (hello CAPS LOCK). Using a URL that contains uppercase characters is common as well. There are a few different outcomes of using a mix of lowercase and uppercase characters. Some websites won’t find the page at all, some finds the page but redirects to the lowercase version, some finds the page but doesn’t redirect you to the lowercase version. These three outcomes will result in three different entry in Google Analytics.

This is a relatively simple filter, take a look at the instructions below:

4. Filter: Hostname

Spammers can be really annoying. This is true for Google Analytics as well. They can easily wreck your data in a few days if they want to. Fortunately, we can avoid most of the spammers by excluding their hostnames from the reports. It’d be impossible to keep up with all the spammers’ hostnames so what we do is only include data from our hostnames. By setting up an include filter we can filter out most of the spam attacks.

Another simple filter, make sure you escape any dots. Here is the pattern: ^(www\.)?littledavid\.io. Replace the domain name and the top-level domain with yours. This pattern includes both www and non-www. See below for the instructions:

5. Set up site search tracking

In order to track site searches and hide duplicate content caused by searches, you should set up the site search tracking in Google Analytics. It can be done in a few steps, if your website doesn’t have an internal search function then simply skip this.

First of all, you need to identify the search query parameter. If you are using WordPress this is s by default. If you have customized it then you can identify the query parameter by looking at your address bar after doing a search.

I also recommend you to tick the Strip query parameters out of URL checkbox. It will remove the query parameter out of the URL, so your data won’t be cluttered like this:

This is how it looks if it is ticked, as you can see every entry shows up as /:

Search terms will still show up in your reports:

It’s up to you to decide what works better for you. Most of the time (about 99%) it should be ticked. If you aren’t sure just go on and tick it, you can’t go wrong with that.

6. Exclude common technical URL query parameters

There are a few extremely common URL query parameters that must be excluded. These can produce quite an amount of duplicate page in Google Analytics. Now, what do I mean by technical URL query parameter? Technical parameters are usually used for some kind of tracking functionality, website search, ecommerce filters, etc. The most common is Facebook’s and Google’s click identifier: fbclid and gclid. If you don’t filter these out, then your Analytics account will be cluttered with these ugly duplicates:

Don’t worry! We can get rid of these duplicates, you won’t see any of these if you keep following this article! First of all, let’s clear up what is fbclid and gclid.

  • fbclid: When someone clicks on a link on Facebook, this parameter is appended so Facebook can track conversions.
  • gclid: When someone clicks on an ad in Google, this parameter is appended so Google can track conversions. If you aren’t running Google Ads, you still should exclude this parameter from Google Analytics. You can never know when this will turn out to be useful.

Let me show you how to exclude these parameters:

After setting this up, our data will look clean, no more duplicates:

Your site might use other kinds of technical parameters. The easiest way to identify them is by looking for them in your Google Analytics data. You can use an advanced search like this:

Searching for just a ? will show every page that contains a query string. In the query string you can spot the parameters by look at them. A parameter is a key-value pair, the string before the = is the key and they string after the = is the value. You will need to add the key into the exclude filter field. For example fbclid=324vxdsad, fbclid is the key, this is what you need to put in the exclude filter field.

7. Exclude internal traffic by IP address

If you are working in a corporate environment then usually they have a static IP or an IP range. The only requirement to set this up is to have a static IP address, which is usually a paid extra service at your internet service provider. You can ask your ISP whether you have a static IP address or not.

You can easily find out your IP address by typing “my ip address” into Google.

Once you know your IP address you can create an exclude filter. If you want to exclude other IP addresses, feel free to create as many filters as you need. If you have a whole range or block of static IP addresses (common in enterprise environments), you can use the “that begin with” or “that contain” expressions.

After setting it up, any new hits coming from the specified IP address(es) will be excluded. You don’t need to worry about messing up your data with your own testing hits!

8. Use annotations

Annotation is one of the best features of Google Analytics. Simple, yet very effective. Annotations are just simple markers at a specific time. When you make changes, it’s recommended to create an annotation so you can keep track of the changes and see how that specific change affected your data. You can also use it for marking milestones or for marking changes made outside Google Analytics. For example, if you make a big change in your advertising campaign, then you may create an annotation so you know when it happened and how your data changed since then.

There are two ways of creating annotations. The first one is from the admin panel, the second one is directly in the reports. Let me show you both by an example:

Conclusion

As I said in the beginning, Google Analytics is a very powerful tool. Make sure you use it correctly! With these best practices your Google Analytics data will stay clean! They are easy to learn and easier to use. Using them won’t take much effort, but in exchange you will get a clean chart. This will come in handy in the future for you, even if you do not see the use of it now.


David Szabo
Web Wizard

Hey, David here. Hope you enjoyed reading this article. I don't have many posts here yet, but keep tuned! Thanks for reading, have a nice day!

Follow me on Facebook and Twitter!

You might love these posts too