Setting up Google Analytics on your website is often as easy as pasting in your tracking code. But are you really getting the most out of your Google Analytics? To really set it up properly, you’ll want to ensure you’re capturing good data, and keep yourself out of trouble.\
Today I'd like to share seven best practices I follow when setting up GA on every new property.
1. Get your CMS in Shape
Your website is where all your data starts, and you’ll want to make sure it’s ideally configured to consistently feed your analytics. This not only helps with analytics, but also has some search optimization benefits and simplifies the user experience, too. Depending on your content management system or application, some of this may require some custom code or add-ons to manage, but these are the areas you’ll want to focus on:
- Be consistent with your www’s: Your site should respond either at www.mysite.com or mysite.com, not both. Be sure to redirect ALL traffic to one domain or the other.
- Strip trailing slashes from URLs: Make sure that people visiting www.mysite.com/somepage/ get redirected to www.mysite.com/somepage without that trailing slash. If you can’t manage that, at least make it consistent.
- Do the same for your indexes and defaults: For example, if www.mysite.com/somepage/index.html is identical to www.mysite.com/somepage, redirect traffic to one or the other, so that only one URL responds for every page.
- Secure everywhere (or nowhere): You have an SSL certificate for your site, right? If you do, always redirect your traffic to https://www.mysite.com/ so that no traffic goes to a non-secure URL.
- Centrally manage tags: You’ll want your tracking code to be in a single place on your site, and not scattered between dozens of master templates. Make good use of how templates inherit in your CMS to ensure you only have to edit a single spot any time you want to make a tracking code update. (Using a tag manager can help here, too.)
2. Keep "All Web Site Data” Pristine
Google Analytics will automatically create a single view for your property called “All Web Site Data.” I have a simple rule for this view: DO NOT EDIT IT AT ALL…NO MATTER WHAT!
That’s right. No filters, no calculated metrics, no goals, no nothing. I will enable things like e-commerce tracking and search tracking, but for the most part I just want to keep a pristine view that I can rely on having all my data without alteration.
Doing this helps with debugging, tracking development efforts, and investigating how my filters and other settings are affecting the core traffic. It also gives me a place from which to get some unaltered data if I accidentally make a new view exclude something vital. (Believe me, it can happen!)
This means the first thing I’ll do is create a view that’s just called “My Site Filtered” (e.g. "BlueModus Filtered”), which becomes my go-to view for all normal analytics. From here on out, all I edit is this view.
3. Don't Forget the Basics
For every view you create, you’ll want to make sure you set the correct time zone (ideally yours, although you may have reasons to match server time or UTC), and set up site search tracking if search happens to be available on the website.
4. Filter out the Garbage
Here’s where “Filtered” lives up to its name. GA can end up capturing a lot of garbage data, including development sites, spikes in traffic when QA load tests the site, and any odd traffic coming in from web scrapers and bots. So you want to filter that all out.
First, you’ll want to filter our bots in the view settings. It’s a checkbox and it does magic that used to require a mile-long regular expression to be constantly monitored and updated.
Next, filter out data that doesn’t relate to your real analytics. I have a few filter rules for this.
First, filter our your host name. This is a regex filter that looks for your hostname. In this case, I’m checking for bluemodus.com, with or without a “www” in front of it. This guarantees that any traffic to my development or staging sites is excluded from this view. (But it’s still captured in All Web Site Data, which I can use to check analytics during development, see how that works?)
You’ll also want to filter out traffic from your own offices. We do this through filtering by IP address:
Additionally, I like filtering out Amazon Web Services traffic, since a lot of bots use it, and all of our internal testing tools make use of it.
Each instance is unique, so you may have some other domains to filter, too. Be particularly cautious of tools you use that can generate a lot of meaningless traffic on their own.
5. Set a Standard
Another area that sometimes throws off analytics is capitalization. I’ll send out a campaign named “October Lead Generation”, but a developer tags it as “october lead generation”, which results in the creation of two separate campaigns in GA. The same can happen with events, host names, and even URLs. Personally, I just prefer everything uniform, so I create filters that make everything lower case - hostnames, URLs, campaigns, sources, mediums, event categories, actions and labels.
These are super-simple custom filters to make, just click "Custom", select "Lowercase", and pick your field.
6. Track Changes with Annotations
I also throw in an annotation as soon as I set the site up, which I simply call “Site Launch” or, if it’s not a new site, “GA Implemented”. If I make changes to filters or other analytics settings, I’ll put an annotation reminding me of what I changed - filters, or site configuration, or whatever. This provides me with a simple and easily accessible history of updates that may affect the site data.
7. Implement Google Tag Manager
Finally, I set this all up with Google Tag Manager instead of just pasting in the GA code. There’s lots of reasons why GTM is superior, but that’s a post for another day. Stay tuned!
In the meantime, if you’d like some information about how to get started with GTM, or further details on the tips above, feel free to leave me a comment!