Want to set up Google Analytics on your website? You’ve come to the right place!
Everyone says Google Analytics is fantastic for understanding your visitors, website, and online biz. But how the heck do you get started with it?
Maybe you had a go at setting up Google Analytics, but couldn’t get it working properly with your site. Or maybe it all seems too hard to even begin!
If this sounds like you, I’ve got you covered. In this tutorial I walk you, step by gentle step, through creating a Google Analytics account, linking it to your website, and testing it all works. You’ll also learn about stopping pesky Google Analytics spam, and find out what to do once you’ve set up Analytics with your site.
By the time you’ve finished reading, you’ll understand the whole setup process and you’ll feel like an Analytics pro!
To keep things simple, I focus on linking Google Analytics with WordPress. If you don’t have a WordPress site, don’t worry — most of this tutorial still applies, and I’ve also included links that explain how to set up Analytics with Joomla, Wix, Weebly and more.
Ready to set up your Analytics? Let’s go!
Step 1: Sign into Google Analytics
To use Google Analytics, you need a Google Account. If you’ve ever used Gmail, Google+, or any other Google service, you already have an account. If not then go ahead and set one up now, then come back here.
Follow these steps to sign into Google Analytics and begin the setup process:
- Go to the Google Analytics website.
www.google.com/analytics/in a new browser window.
- Sign into Google Analytics.
Click the SIGN IN link in the top-right corner, then click Analytics in the pop-up menu that appears:
- Sign into your Google Account.
If you’re not already signed into your Google account then enter your email address, click Next, enter your password, and click Sign In:
- Begin the Analytics signup process.
A page appears explaining the setup process. Click Sign up to continue:
Step 2: Enter your account details
Once you’ve clicked the Sign up button in the previous step, you’ll see a New Account page appear. Here’s where you enter the details of your Google Analytics account and website:
Here’s how to fill in this form:
- Website / Mobile app: Google Analytics lets you track visits to your website, as well as usage of mobile apps. Since you want to track your website traffic, make sure Website is selected.
- Account Name: This will usually be the name of your business. You can track several websites (known as properties in Analytics-speak) under one account, but in this tutorial you’ll just track one site.
- Website Name: Enter the name of your website here.
- Website URL: Enter the URL (web address) of your website’s homepage — for example,
www.example.com. If your website uses HTTPS — which is usually a good idea — then click the button to the left of the URL text field and change http:// to https://.
- Industry Category: This setting is optional. If you set it to your biz’s industry then it helps Google tailor their reports, communications and educational tools to your needs. It doesn’t affect your visitor tracking at all.
- Reporting Time Zone: Pick your time zone to make sure the reports use the correct times for your location.
- Data Sharing Settings: These settings control what Google does with your Google Analytics data. They’re all selected by default, but feel free to deselect any of them. You can always turn them on again later.
When you’ve entered all your details and reviewed your data sharing settings, scroll down and click the Get Tracking ID button:
You’ll see a popup containing the Google Analytics terms of service. Select your country from the drop-down menu, then click the I Accept button to accept the terms:
Step 3: Insert the tracking code in your website
Once you’ve agreed to the terms, Google Analytics takes you to the Tracking Code admin page for your property (website):
There are two important things on this page:
- Your Tracking ID: This is a unique string of text that identifies your Google Analytics account and website. In the screenshot above it’s
UA-XXXXXXXX-1, but your Tracking ID will contain digits instead of the Xs.
Keep this page open, as you’ll need to copy your Tracking ID or tracking code in a moment.
Here’s how to insert the tracking code on your WordPress site, as well as on other types of site:
Method A: Insert the code using a WordPress plugin
This is the easiest way to install the tracking code in WordPress.
There are many free WordPress plugins that automatically insert the tracking code into every page of your site. I like the GA Google Analytics plugin because it’s simple to use.
Follow these steps to install the plugin and insert your tracking code:
- Log into your WordPress admin.
Open a new browser tab. Visit your WordPress admin URL, enter your admin username and password, and click Log In.
- Search for the GA Google Analytics plugin.
In the left-hand admin menu, choose Plugins > Add New. In the Search Plugins box at the top right of the page, type ga google analytics and press Return.
- Install the plugin.
Find GA Google Analytics in the search results, and click Install Now to install the plugin:
- Activate the plugin.
After a short while, the Install Now button should change to say Activate. Click the button to activate the plugin. In a few seconds, you’ll see the message Plugin activated appear at the top of the page.
- View the settings page.
In the left-hand menu, choose Settings > Google Analytics to display the plugin’s settings page:
- Display the settings.
Click the Plugin Settings header in the settings page. It expands to reveal the settings:
- Enter your Tracking ID.
Switch to your Google Analytics browser tab again. Select your Tracking ID in the Google Analytics Tracking Code admin page that you kept open earlier. Choose Edit > Copy to copy the Tracking ID, then switch back to your WordPress browser tab and click the box next to GA Property ID. Choose Edit > Paste to paste your Tracking ID into the box:
- Enable Analytics and Universal Analytics.
Select both the Enable Analytics and Universal Analytics checkboxes to turn on the tracking. (Universal Analytics is the latest version of the Google Analytics tracking code; you almost definitely want to use it.)
- Turn off tracking for your own visits (optional).
Google Analytics tracks your own visits to your site, just as it tracks your visitors’ visits. If your site doesn’t get much traffic — and you visit your own site a lot — then your own visits can distort your Google Analytics reports quite a bit! To help with this, you can select the Disable GA on the frontend for Admin-level users checkbox. This stops the Google Analytics tracking code being inserted into pages when you view your site. (Just make sure you’re logged in as a WordPress admin user whenever you visit your site!)
- Save your changes.
You can ignore all the other settings for now. Click the Save Settings button to save your changes:
All done! The plugin should now insert your Google Analytics tracking code into every page of your site. You can skip ahead to Step 4 below!
Method B: Copy and paste the code into your WordPress theme settings
- Log into your WordPress admin.
Open a new browser tab and visit your WordPress admin page. Enter your admin username and password and click Log In.
- Access the theme settings.
In the left-hand WordPress admin menu, choose Genesis > Theme Settings:
- Find the Header Scripts box.
Scroll down the page until you see the Header Scripts box. It’s inside the Header and Footer Scripts section.
- Copy and paste the tracking code.
- Save your changes.
Click the Save Changes button at the bottom of the page to save your tracking code.
If you’re not using a Genesis theme then your admin page will look different, but there is usually a box called something like Header Scripts or <head> Code somewhere in the theme settings.
header.php file. (If you go this route, make sure you create a child theme first to avoid your changes being overwritten when you update the theme.) To edit your
header.php file, choose Appearance > Editor in your WordPress admin and click the
header.php template in the right column:
Make sure you paste the code just before the
</head> tag in the header:
Once you’ve pasted the code, click the Update File button below the editor box to save your changes.
How to insert the code into other types of site
No WordPress? No problem! Here’s how to add your Google Analytics tracking code to other website platforms:
- Joomla: As with WordPress, there are tons of free Google Analytics plugins available that insert the tracking code on your site pages. Asynchronous Google Analytics is a good one.
</head>tag as described in Method B above. Here are the instructions you need.
- Squarespace: Just paste your Google Analytics Tracking ID into Squarespace’s Google Analytics Account Number box. Full instructions here.
- Wix: You need to have a Wix Premium Plan with your own domain. Then you paste your Google Analytics Tracking ID into the Google Analytics Code box under the Analytics tab. Here’s how to do it.
Step 4: Check the tracking code appears in your pages
Now that you’ve installed the tracking code on your site, you need to make sure it’s appearing on each page of the site. Here’s how to do that:
- Visit your site’s homepage.
Open a new browser tab and go to your site’s homepage. (If you turned on the GA Google Analytics plugin’s Disable GA on the frontend for Admin-level users feature in Step 3 earlier, make sure you log out of your WordPress admin before visiting your homepage.)
- View the page source.
Use your browser’s View Source feature to view the HTML source code of your homepage. For example, in Chrome, choose View > Developer > View Source.
- Look for the tracking code.
If you don’t see the code anywhere in your page source, try clearing your browser’s cache. If that doesn’t work, check that you’ve inserted the tracking code correctly in your site’s admin.
Step 5: Check the tracking works
Your tracking code is installed on your site, but does it actually work? Follow these steps to find out:
- Go to the Tracking Code page in your Google Analytics admin.
You may still have this page open from before. If not then visit
analytics.google.comand click the ADMIN menu option. In the PROPERTY column, click Tracking Info, then click Tracking Code:
- Send a test visit to Google Analytics.
Make sure you’re logged out of your site admin if necessary (see Step 4: Check the tracking code appears in your pages). Then click the Send test traffic button on the Tracking Code page. This opens your site homepage in a new window, which should then register as a “visit” in Google Analytics:
- Check that the visit registered.
Look closely at the “active users” text above the Send test traffic button. Within 30 seconds, you should see the figure change from 0 to 1:
You’ve now set up Google Analytics tracking on your site. Nice work!
Step 6: Deal with Google Analytics spam
You know, I wish I didn’t have to write this step! Sadly though, even Google Analytics is a target for spammers these days. They send fake ‘visits’ to your site with spammy data, which then shows up in your Google Analytics reports.
Dealing with Google Analytics spam is quite an advanced topic, so I’m not including it in this beginner’s guide. I don’t want to overwhelm you! But it’s definitely something you’ll want to keep on top of.
Just about the best article on this topic is Mike Sullivan’s Definitive Guide to Removing All Google Analytics Spam. I recommend you read through this a couple of times, and then go ahead and do at least the first two steps in the article:
- 1. New Website? Use a ‘-2’ Property: Since you’ve just started using Analytics, this is a good time to do this step. It will get rid of a large chunk of your spam.
- 2. Implement a Valid Hostname Filter for Ghost Visits: This is the best way to eliminate fake Analytics spam, so you should definitely do this step.
(If you need assistance with fighting your Google Analytics spam or setting up filters, get in touch and I’ll be happy to help!)
Get started with Google Analytics today!
Google Analytics can seem hard at first. However, if you followed this tutorial then you’ve set up an Analytics account and linked it to your website. Google Analytics is tracking your visits and you’re well on your way to becoming an Analytics ninja. You are awesome!
After a couple of days, you’ll start to see some visits appear in your Google Analytics. But how do you make sense of it all? What can Google Analytics actually tell you about your visitors, site, and business?
Never fear, dear reader. I have answered these questions — and more — in another article! Go and read How Google Analytics Can Answer These 11 Burning Questions about Your Website to get the most from your brand new Google Analytics account. Have fun! 🙂
Do you have any questions or roadblocks with setting up your Google Analytics? Feel free to ask them in the comments below!
[Image credits: Man with book by Peggy & Marco Lachmann-Anke (CC0), cropped, edited]
Leave a Reply