Google Analytics Tutorial: How to Add Google Analytics to Your WordPress Website & Why You Should!
Why? Well, with Google Analytics you can see the exact (and I mean, exact to a creepy level) demographics of your site visitors, such as their age, gender, location, device they use, how they got to your site, how long they stayed and even what page they were on when they left.
This data is key to 1: confidently determining exactly who your audience is (meaning if your site is constantly being visited by 18-24 yrs olds, you can tweak your content to speak to them, rather than the 35-44 audience you thought you were attracting). 2: where your site is falling short – when people visit your site, but leave within 20 seconds, that means something is wrong. Maybe your navigation isn’t working, or there’s too much content on the homepage, or the design is just overwhelming, and 3: where they’re coming from – if you’re getting a lot of traffic from LinkedIn, it may be a good idea to invest a bit more time there.
These three examples are just the tip of the iceberg of what you can do with Google Analytics, and don’t worry, you don’t need to master it all now. All you need to do is install it so that when you’re ready to start getting analytical you have tons of data to go through
Google Analytics Tutorial Part 1: Create a Google Analytics Account
1. Navigate to google.analytics.com
2. From here you will need to sign into a gmail account. If you don’t have one, simply click the ‘create account’ button and follow the steps.
3. Once logged into your gmail account, click the sign up button on the far right of the screen
4. From here you’ll fill out the following fields:
Account Name: I recommend putting you or your company’s name here.
What do you want to measure: web
Website Name: the name of your website
Website URL: the url of your website. If you have a secure url, select “https://” from the drop down list. If you aren’t sure, leave it as ‘http://’.
Industry Category: find the closest category to your niche, or leave this blank (this information is used to track how other sites in your industry compare to you)
Reporting Time Zone: your time zone
5. On the next page you will find your Google Analytics script. Leave this page open as you’ll need it later.
At this point, your google analytics account is set up! Now we need to connect it with our WordPress website!
Google Analytics Tutorial Part 2: Connect Your Account to Your Website
There are three different ways we can do this. Starting with the easiest, which is using a plugin. Plugins are what make WordPress so special. There is a plugin for absolutely everything and it makes customizing your site so easy. The only downfall with plugins is that if you have too many they can start to slow down your site so if you’re trying to avoid adding a new one, check out options 2 & 3 below!
Option 1: Use a Google Analytics Plugin
1. Sign into your WordPress website (often via yourdomain.com/wp-admin).
2. Once logged in, hover over the ‘Plugins’ button on the left sidebar and select ‘Add New’
3. From here, type ‘Google Analytics’ into the search bar on the right side.
4. As you can see there are many options but today we will be using ‘Google Analytics Dashboard for WP by ExactMetrics’
5. Click the ‘Install’ button, then after a few seconds, click the blue ‘Activate’ button that appears.
6. Your page will refresh and you will now see a ‘Google Analytics’ tab on the left sidebar. Click that to finish setting up the plugin.
7. From here you will need to authorize the plugin in and click the ‘Get Access Code’ button.
8. This will take you to a page where you need to login again with the same gmail account you used to set up your Google Analytics.
9. Copy the code you’re given and paste it into the plugin.
The page will reload with your Google Analytics data and you are done!
Option 2: Use Your Theme’s Internal Google Analytics Function
Not all themes will have this but it’s worth checking to see if yours does. To do this, you’ll log into WordPress, then navigate to your Theme Options on the left sidebar (usually under Appearance > Theme Options, or under the name of your theme. For me, it’s titled Thrive Dashboard)
1. Once inside your theme options, look and see if there is a Google Analytics option. Mine is titled “Scripts & Analytics”
2. Here you will paste the code you were given after creating your Google Analytics account (if you closed the page you can find it by going to Admin > Tracking Info)
3. If you have the option to choose, make sure it’s placed “before the </head> tag”
4. This will ensure that the Google Analytics script shows up on every page of your website.
Save your settings and that’s it!
Option 3: Update Your Website’s Header File
Finally, the third option in this Google Analytics Tutorial is to add the code directly to your websites internal files.
Warning: this method does require editing the functioning code of your website. If you make a mistake or edit/delete something you shouldn’t have, it could break your website. Please follow the instructions exactly as they’re outlined.
1. Once logged into WordPress, navigate to to ‘Appearance > Theme Editor’
2. On the right side, find the ‘Theme Header (header.php)’ link and click it.
3. Scroll down until you find this tag: “</head>”. You will be placing your Google Analytics code directly before this tag.
4. Open your Google Analytics, copy the tracking code (if you closed the page you can find it by going to Admin > Tracking Info) then paste it right before the “</head>” tag.
Click save and you’re done!
Google Analytics Tutorial Part 3: Check That It’s Properly Installed
Finally, you’ll want to check that your Google Analytics is properly set up.
To do this, open a page on your website (for example, your contact page). Then, open up Google Analytics and select Real Time > Overview on the left sidebar. Wait a couple seconds and you should that at least 1 person is on your website (you!) and that the page they are on is the contact page (or whatever URL you are on)
If you see that, everything is working! Google Analytics will now continue to collect data from all of your site visitors and you will be able to see the information after the first 24hrs.
So that is how you install Google Analytics on WordPress! I hope this tutorial helped and you are now on your way to better tracking your website analytics!