Disclosure: This post may contain affiliate links, meaning if you decide to make a purchase through my links I may earn a commission at no additional cost to you. See my disclosure for more info.
Are you wondering how to set up Google Analytics on your WordPress website? I know it can feel a little intimidating and confusing as there are a number of steps you need to take in order to get the Google Analytics tracking code set up the right way.
Fortunately, I’m going to guide you step-by-step through the entire process! I’ll show you:
- How to set up a Google Analytics 4 (GA4) property and Universal Analytics (UA) property and connect them together.
- How to insert the tracking code/ script into your website’s head tag. I’ll also show you how to test it to make sure it’s working properly.
- How to create a filter to exclude your IP Address so that your activity on the website won’t inflate and/or skew any of the data!
What is Google Analytics & Why Do You need it?
Google Analytics is a free web analytics tool that provides you with valuable statistics and insights to track and analyze your visitors’ behavior so you can identify what users are doing on your website and make informed, data-driven decisions about your future marketing efforts.
This tool is insanely powerful! For instance, you can track…
- The number of people who have visited your site in a specific time period
- How many of those users visited your website for first-time or are returning visitors.
- Your audience interests and demographics (like age, gender, and location).
- How your visitors discovered your website – whether they found you on a specific search engine, Facebook, Instagram, Pinterest, YouTube, or even another referring website.
- The pages or blog posts on your wesite that are the most visited.
- The amount of time someone stays on a specific page on your website.
- Which devices your visitors use the most.
- The number of leads, conversion rates, newsletter signups and more when you set up goals.
- And so much more!
Data like this will help you become a strategic marketer and make smart decisions that can lead to more engaged visitors, higher conversions, and ultimately more customers and sales.
In the next section, I’ll show you how to get your Google Analytics properties set up and installed on your website.
Go Deeper With Google Analytics
If you’re wanting to go deeper and learn more about how to utilize Google Analytics for your business… I highly recommend checking out Pavel Brecik’s The Ultimate Google Analytics Course on Skillshare.
The best part is you can start learning for free! You can sign up for Skillshare here and get a free 1-month trial! Beyond Pavel’s course, you can also access thousands of other bite-sized classes on your own schedule, anytime, anywhere on a desktop, or through their mobile app!
How to set up Google Analytics 4 (GA4) property and Universal Analytics (UA) property
Alright, let’s get this tutorial started.
Part 1. Sign up for a Google Analytics Account & Complete The Setup Wizard
Go to Google Analytics: https://analytics.google.com
NOTE: You’ll need to be logged into the correct Gmail account that you want to have associated with your analytics. I would hate for you to be logged into the wrong account and have to delete it and start over on the correct one.
If you don’t already have a professional email address that matches your business name and domain, this is a great opportunity to get one with Google Workspace that way your business email is connected to your Google Analytics account.
I personally use Google Workspace for my email and also love all of the productivity tools you get for such an affordable price! If you’ve chosen another provider like Microsoft Office365 or are using the mail that came with your hosting provider just use another Google account instead.
If you’ve never set up a Google Analytics account before, you’ll see a “Welcome to Google Analytics” screen after you log in. In that case, click the start measuring button. This will take you to the setup wizard.
If you already have a google analytics account set up, once you log in, click on Admin (gear icon) in the bottom left-hand corner.
Then choose “Create Account” to start a new one.
Account Setup Screen
That will take you to the account setup screen.
- Give your account a name. (I recommend using your business name.)
- Check off all four boxes
- Click next
Property Setup Screen
- Give your property a name. I recommend calling this “[your brand name] website”. Giving the property a specific name is very important especially if you own or manage multiple properties!
- Update your reporting time zone
- Update your currency
- IMPORTANT! Click show advanced options so we can create a Universal Property as well as the Google Analytics 4 Property.
- Click the toggle button to create a Universal Analytics property
- Add your website URL address
- Select Create both a Google Analytics 4 and a Universal Analytics Property
- Select enable enhanced measurement for Google Analytics 4 property
- Click next
About Your Business Screen
- Select your industry
- Select your business size
- Check off all of the ways you intend to use Google Anlaytics with your business
- Click create
Terms of Service Agreement Pop-up
- A screen will pop up with the Google Analytics Terms of Service Agreement.
- Review the Terms of Service and then check the box next to the “I also accept…” option.
- Review the Google Measurement Controller-Controller Data Agreement and then check the box next to the “I accept the Measurement Controller Data…” option.
- Click I accept
Part 2. Connect Your GA4 Property & UA Property
Next, we’re going to connect the new Google Analytics 4 (GA4) property, which was released in October 2020, to the old Universal Analytics (UA) property.
The reason for connecting them is so that that you only have to put 1 tracking code on your website that allows the data to automatically get collected in both properties. Both property views have valuable data points and once they’re connected, you’ll be able to share settings from both property views.
WebStream Details Screen
After you’ve accepted the terms, the next screen that pops up will be the webstream details.
- Under the tagging instructions section, click on the “Use existing on-page tag” tab.
- Click the “Google Analytics” dropdown. This will show you the next steps you need to take and will give you the measurement ID. Copy this tracking ID to your computer clipboard!
- Next, you’ll want to duplicate your tab. On your browser tab, right-click and choose duplicate so that you have two tabs open with the same information.
Connect Tracking Code & Site Tags
- On one of the tabs, closeout of web stream details (and any other pop-ups that may be on the screen) and click on the all accounts drop-down
- Hover over the Analytics Accounts > select the Property & App that has the prefix “UA-” in front of the numbers > select All Web Site Data
- Click on Admin (gear icon) in the bottom left-hand corner. Under the Property column, click on tracking info > tracking code.
- Click on Connected Site Tags
- This will open up the Connected Tags screen and paste the measurement ID that you copied on your computer clipboard.
- Give the tag a nickname. I called mine “Universal Analytics” or you could call it “UA”
- Click Connect.
You should see the connection automatically appear.
How To Insert the Tracking Code Into Your Website’s Head Tag
Now that the two properties are connected, we need to add the tracking code to your website so it can start gathering data. Let me show you how to do that next.
Copy The Script In Google Analytics
- Go back to the first tab that has the screen with the web stream details.
- Under the tagging instructions section > click the “Add new-on-page tag” tab.
- Click on the Google Site Tag (gtag.js) dropdown.
Paste To Your Website Head Tag
Next, you’ll need to paste this script to the head tag.
If you’re using the Kadence theme (which is my #1 theme recommendation) and have upgraded to Kadence Pro, you can easily paste these scripts into your site’s header, right after opening the body tag. I’ll show you how to do that.
If you do not have the Pro version of Kadence, you can also insert this script into your site by installing a free third-party plugin. I’ll also show you that option as well.
Insert Your Google Analytics Tracking Code With Kadence Pro
- First, make sure to have purchased a Kadence Bundle, installed the Kadence Pro plugin, and have entered your license details.
- Then go to Appearance > Kadence and enable Header/Footer Scripts.
- Click on the “Customize” hyperlink to be taken to the Custom Scripts section in the WordPress Customizer. You can also get there by going to Appearance > Customize > Custom Scripts.
- Simply paste the tracking code and hit publish.
Add Google Analytics Tracking Code Using A Free Insert Headers/ Footers Plugin
If you do not have the Pro version of Kadence, you can install the plugin “Insert Headers and Footers by WPBeginner”.
- Go to Plugins > Add New
- In the search bar, type insert headers and hit enter
- Click “Install now” on the plugin Insert Headers and Footers by WPBeginner
- Click “Activate”
- On the left-hand side, hover over settings and click on Insert headers and footers
- Paste your scripts and hit save!
Once you’ve completed this step, this will apply the tracking code to every page of your website!
How to verify your Google Analytics Account Is Working Properly
Next, let’s make sure that the tracking code you just added to your WordPress website is functioning.
- If you have a caching plugin on your website (like the SG Optimizer plugin that automatically comes with Siteground hosting or a premium caching plugin like WPRocket), clear your website’s cache. You may also need to clear your browser’s cache.
- Close out of your website in all browsers.
- Open an incognito window in your browser and visit your website.
- In the google analytics tab that we previously had opened (not the tab with the web stream details), click on the home icon.
- Under reports, click on realtime and then click overview
- When that screen loads, you should see that there is 1 active user on your website right now, which is you in that incognito window! If you do not see an active user, you may also need to wait a few minutes and try again.
Once you see that a user is active on your website, you’ll know the tracking code is working properly! At this point, you may be thinking, “my work here is done”…. but not so fast! There’s still one more step to complete.
How to Exclude Your IP Address From Google Analytics
Every time you visit a page on your website to edit or review it, Google Analytics reports it. You don’t want your activity on the website to inflate and/or skew any of the data like conversion rates, bounce rates, page views, sessions, and more.
If you want to make sure that your Google Analytics data is clean, I highly recommend excluding your IP address.
Make sure to keep your website open in an incognito window so you can ensure this process works correctly.
Setting Up The Filter
- On your google analytics screen, click on the admin tab (the gear icon) in the bottom left-hand corner
- Under the third “View” column, click on filters
- Next, click the red “add filter” button.
- Give the filter a name such as “exclude office” or “exclude IP”
- Under filter type, select custom. Ensure the Exclude option is selected.
- Click on the filter field dropdown and begin typing “IP” in the search bar & select IP Address from the dropdown.
- In a new browser tab, type “What’s My IP” into Google and copy the IP Address shown in the field. For security reasons, I have it blurred out in the screenshot, but you’d copy the numbers shown.
- Return back to the filters on your Google Analytics tab and paste your IP address into the filter pattern field.
- Click save.
If you go back to the home screen on your google analytics account, you should see the “active users” number return to 0 even though you are viewing your website in an incognito window!
This, of course, works great if you’re a solopreneur or blogger. If, however, you’re a small business that has a number of internal employees visiting your website and want to exclude a range of IP addresses, watch this YouTube video by Ray Sawvell to complete those steps.
Don’t Forget to Setup Google Search Console
Google Search Console is another free tool from Google that helps you understand how your website is performing on Google Search. You can also monitor your website traffic, optimize your ranking and make informed decisions about the appearance of your site’s search results.
COMING SOON… I’ll create a post guiding you through the Google Search Console set-up click-by-click! Sign up for my email list to get notified when it goes live.
Join Katy’s E-mail List!
Become An Insider
Get strategic website & marketing tips sent to your inbox, plus get first access to the latest posts, products, services, and more!