How to Set Up Google Analytics Like an Agency Professional
Seeing weird traffic patterns? Think you might be counting your own office traffic in analytics reports?
You’re not the only one, and there are straightforward fixes for all of those problems.
Google Analytics is the greatest gift to digital marketing since Tim Berners-Lee pioneered the Internet itself as we know it, but there are a few tricks to setting it up properly to avoid reports that can throw your reports for a loop.
Check these items off your list to set up Analytics like a pro—You’ll also set yourself up for success down the road with Data Studio reporting and Google Ads reporting with these tips, too.
Quick Note: We’ll walk you through the step-by-step process of setting it up, but feel free to scroll down to the advanced sections if you’re just looking to solve one or two specific problems.
Create Your Analytics Account (and Property)
This part is simple, but clicking on the right button isn’t always obvious (Google marketing platforms aren’t known for a great user interface).
Step 1: Turn your email into a Google account if it isn’t through Gmail or Gmail for work.
Step 2: Create a new Google Analytics account, which will be tied to your Google email account. Click “Start for free.”
Note: You can share access and transfer ownership down the road if you like, but do put some thought into which email address is going to “own” the account for your organization—you want to be able to access it on short notice, so it’s best not to tie it to a single employee’s address.
Step 2b: Google will create an account within Analytics for you if it’s your first time, but here’s what to do if you need to create a new account for a client or a separate branch of your organization:
- Click on “Admin” at the bottom left-hand menu, with the gear icon.
- You’ll see 3 columns. The left-most one has a blue “Create Account” button at the top of it. Click on it.
- Fill out the domain name and all related information: timezone, your website’s approximate industry.
- Hit “save.”
Step 3: Create a new “property.” Within Google Analytics, click on the “Admin” button at the bottom of the left sidebar menu. It has a gear icon next to it, but you might only see the gear icon if the menu is collapsed.
Step 4: Create a new View within your property. From the Admin screen, look at the top of the right-most column. Click on the blue “Create New View” button. This will leave you with two views
A Quick Note on How Google Analytics is Structured
There’s a lot of terminology flying around here, and you might not be be familiar with all of it. Here’s a cheat sheet:
- Account: It’s the “master” level for Google Analytics, but different from your Google account. The difference is that your Google email account can access multiple Google Analytics accounts
- Property: this is the website or app itself. It comes with its own tracking code specifically for itself. You can fit 25 properties into a single Analytics account.
- View: Views are configurations to see data for a property in a certain way. You can git 25 views into a given property.
It’s worth remembering that structure when you’re handling permissions. Do you want a coworker, agency partner, or consultant to have access to your entire Google Analytics account, just the one website/app in particular, or maybe even just a strictly filtered view of that website?
Serve Analytics Through Google Tag Manager
Google Analytics gives you a code snippet (a “tag”) that you can copy and paste directly into your website, but I wouldn’t recommend implementing it that way.
By the time you get around to adding tracking tags for Google Ads, Facebook Ads, Twitter Ads, and any third-party snippets (like Hotjar), it’s going to get super crowded on your site. That many tags being hardcoded onto your site will likely slow it down as well, since each one needs to load on its own.
Enter Google Tag Manager. You can manage all of those tags in one spot and load all of those tags into your site through one. The Tag Manager code is actually called a container—because it’s a container for all of your other tags.
Here’s how to create it:
- Grab the Google Analytics code and copy it to your clipboard (pictured above).
- Create a Google Tag Manager account.
- Create a container for the website or property.
- Within the GTM workspace, click on “Create New Tag.”
- Select Google Analytics Universal Tracking Code.
- Select View on All Pages.
- Under “Triggering,” select “All Pages.”
Pro Tip: Google Analytics only records site speed for 1% of your visitors by default. You can change that to 100% to get a better idea of how your website’s performance is doing. Under the same screen in Tag Manager, follow More Settings > Fields to Set:
- Add “siteSpeedSampleRate” under the Field Name.
- Add “100” to Value.
That should tell your Google Analytics tracking code to record site speed performance for every visitor that lands on your site, creating much more accurate reports. Nice.
Install on Your Website (WordPress Example Included)
Since we’re serving Google Analytics through Google Tag Manager (see the step above), we’re not actually going to install the Universal Analytics code snippet—we’re going to install the Tag manager code snippet.
There are actually two components to the Tag Manager snippet that go in two locations:
- The header section of your web pages
- The beginning of the <body> section of your web pages
You’re not going to manually insert both parts of the code snippet on every page, obviously. That’d be crazy talk. Instead you should paste them into their respective spots by means of your theme or a plugin.
There are a few ways to do it:
- Use any code snippet fields available in your theme. For example, sites running on Divi can paste the code snippets into the <head> and <body> fields.
- Install a WordPress plugin that lets you paste code snippets into your <head> and <body> fields. Look at these plugins:
I recommend trying to insert the code snippets through your theme first, if you’re able to do so—the reason being that it will let your website run a little bit faster if you don’t install a plugin.
Many websites out there also try to walk you through pasting the code snippets directly into your WordPress theme code, but—and I’m being serious here—don’t do that. Do it through an easily managed plugin or theme feature. Don’t mess around with your theme code.
Crucial Best Practices for Your Analytics Setup
There are some things that every single marketer needs to do with their Analytics accounts. Start with these right after you’ve created your account and set it up on your website.
Keep an Unfiltered View
Keep an unfiltered view at all times and just don’t use it—just in case.
That’s because of the way Google Analytics works. It doesn’t keep all of the master data on a super-secret server somewhere for a support rep to “unlock” in case you run into technical difficulties.
Analytics can only store data as it gets recorded. It can restore the data in a pristine state, but it will ignore data if you apply filters (which is both common and necessary for day-to-day analysis). If you decide that you want to see the unfiltered data to double-check something and you’re only using a single View, then you’re S-O-L.
So here’s what you do:
- Click on the Admin menu item on the left-hand menu.
- Drag your mouse to the far-right column, then click on the blue “Create View” button.
- Select “Website” under “What data should this view track?”
- Set your timezone. Seriously, don’t forget this this one.
- Hit “Create View.”
And you’re done this step!
Create IP Address Filters
Create IP filters to exclude yourself, coworkers, clients, or partners from adding inaccuracies to your analytics. If you or someone else is working on the site, they could visit it 50 times in a day, click on CTA buttons to test tracking capabilities, and so on.
You do not want that test activity in your performance data, especially when reporting time rolls around.
Here’s how to block certain IP addresses in Google Analytics:
- Get your public-facing IP address from WhatIsMyIP.com and copy it to your clipboard.
- Click on Admin on the left-hand menu.
- Make sure you’re on your Production View and not your Failsafe View (where all of your pristine, untouched data lives!).
- Click on “Filters” under the far right-hand column.
- Click on “Create New Filter” just off-center from the top of the screen’s list of filters.
Once you’re in the filter creation screen, follow these steps:
- Name your filter. Choose something easy to identify by skimming.
- Select “Predefined Filter Type.”
- In the row below the filter type, select these three options:
- “traffic from the IP addresses.”
- “that contain.
- Paste your IP address into the text field blow, hit Save.
And that’s it for this step!
Bots are just fake users that crawl your site to understand its content. The ones you want on your website are from Google, Bing, Yahoo!, and any tools you might use (like SEMrush or ahrefs). You can’t really block any from landing on your site (it’s publicly accessible by nature), but you can make sure that they don’t dilute your traffic analytics.
As of writing, I believe Google Analytics received an update in early 2019 to come with this feature enabled out of the box—but I’m going to include this anyway because it’s not always the case.
Click through to the usual Admin menu, then View Settings. On the new screen, scroll down to the bottom and make sure that the box is ticked for “Bot Filtering.”
Pro Tip: also make sure that your website’s URL is set to “https” instead of just “http.” If your site is running without an SSL certificate (to give it the https protocol), then get on that ASAP.
Prepend the Hostname to the URI (With One Caveat)
This one is a bonus for those of you out there using subdomains—likely for landing pages through Unbounce or Landing Lion.
If not, then it’s not a big deal—ignoring them actually makes reports easier to read otherwise, I find. But if you’re using subdomains then you want to be able to see which domain the page URL slug belongs to—otherwise you might never know.
Here’s how you do it:
- Navigate to the Admin page, then the Filters page under the View column (farthest to the right).
- Name your filter “Prepend Hostname to URI.”
- Select Custom > Advanced.
- Field A > Extract A: Hostname; (.*)
- Field B > Extract B: Request URI; (.*)
- Output To > Constructor: request URI; $A1$B1
- Field A is Required (Field B is Not).
- Override Output to Field should be checked.
- Case Sensitive should be unchecked.
You may recognize some of those characters from Excel. There’s a reason for that! They both run on Regular Expressions (or RegEx), which is why these look similar.
Anyway—with that, you’ll have built your analytics foundation for cross-domain tracking.
And that’s it for the Google Analytics tutorial today.
Andrew is the digital marketing consultant at Webb Content. He's worked in a few different agencies full-time and with another seven or eight as a consultant.
He's usually writing new content, creating the occasional website, and constantly finding new ways to optimize those sites. It's kind of an addiction.
Book a free consultation to see what your strategy really needs.
We'll take the time to learn about your business and identify some next steps for your digital marketing strategy, even if we aren't a fit for each other. It's what we do.