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.

A screen showing the Google Account signup screen with a pre-existing email address.

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:

  1. Click on “Admin” at the bottom left-hand menu, with the gear icon.
  2. You’ll see 3 columns. The left-most one has a blue “Create Account” button at the top of it. Click on it.
  3. Fill out the domain name and all related information: timezone, your website’s approximate industry.
  4. 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.

The Admin view of Google Analytics, visualizing the three structured levels: account, property, and view.

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.

A screenshot of how to find the universal analytics tracking code inside Google Analytics.

Here’s how to create it:

  1. Grab the Google Analytics code and copy it to your clipboard (pictured above).
  2. Create a Google Tag Manager account.
  3. Create a container for the website or property.
  4. Within the GTM workspace, click on “Create New Tag.”
  5. Select Google Analytics Universal Tracking Code.
  6. Select View on All Pages.
  7. Under “Triggering,” select “All Pages.”

A screenshot of Google Tag Manager showing how to set up a universal tracking Analytics tag set to track hits on page views, triggering on 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:

  1. Add “siteSpeedSampleRate” under the Field Name.
  2. 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:

  1. The header section of your web pages
  2. 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.

A screenshot of how to add the Google Tag Manager code snippets to the <head> and <body> sections of WordPress without touching theme code.

There are a few ways to do it:

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:

  1. Click on the Admin menu item on the left-hand menu.
  2. Drag your mouse to the far-right column, then click on the blue “Create View” button.
  3. Select “Website” under “What data should this view track?”
  4. Set your timezone. Seriously, don’t forget this this one.
  5. Hit “Create View.”

A screenshot of Google Analytics' Admin screen with a green arrow pointing from the Admin button to the "Create View" button under the View column.

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:

  1. Get your public-facing IP address from WhatIsMyIP.com and copy it to your clipboard.
  2. Click on Admin on the left-hand menu.
  3. Make sure you’re on your Production View and not your Failsafe View (where all of your pristine, untouched data lives!).
  4. Click on “Filters” under the far right-hand column.
  5. Click on “Create New Filter” just off-center from the top of the screen’s list of filters.

The Filters screen within the Admin section of Google Analytics.

Once you’re in the filter creation screen, follow these steps:

  1. Name your filter. Choose something easy to identify by skimming.
  2. Select “Predefined Filter Type.”
  3. In the row below the filter type, select these three options:
    1. “Exclude.”
    2. “traffic from the IP addresses.”
    3. “that contain.
  4. Paste your IP address into the text field blow, hit Save.

A screenshot of an IP address filter being created inside Google Analytics.

And that’s it for this step!

Exclude Bots

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.”

A screenshot showing how to exclude bots from registering as hits in Google Analytics.

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:

  1. Navigate to the Admin page, then the Filters page under the View column (farthest to the right).
  2. Name your filter “Prepend Hostname to URI.”
  3. Select Custom > Advanced.
  4. Field A > Extract A: Hostname; (.*)
  5. Field B > Extract B: Request URI; (.*)
  6. Output To > Constructor: request URI; $A1$B1
  7. Field A is Required (Field B is Not).
  8. Override Output to Field should be checked.
  9. Case Sensitive should be unchecked.

A screenshot showing how to create a custom filter to prepend the domain hostname to the URI of pages tracked in Google Analytics.

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.

Cheers, friends.

Andrew Webb

Andrew Webb

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.