Set up + install Google Analytics on WordPress

One of the first things I do when launching a new website is install Google Analytics on WordPress. If you didn’t know, Google Analytics is a free service provided by Google to track your site traffic — anything from how long users spend on your site to what website they came from to what page on your site they left. In fact, some of the data you can gather is borderline scary (device type, browser of choice, screen size, etc.)

But none of this is available to you if you don’t install Google Analytics on WordPress. And worse yet, you cannot go back in time to get data about your site users. Which means if you’re even thinking about using Google Analytics down the road, you want to install it now.

The best news, aside from this being a free tool for your business, is that you have multiple ways to correctly add the code to your site. We’re gonna start with the easiest first + end with the nerdiest option, after walking through setting up your account.

Your site tracking code + account number

Head to to set up your free Google Analytics account. From there, you’ll want to log in with any Gmail or Google Apps/GSuite email address you have. Click the “sign up” button to get started.

This page is where you’ll enter in the information about your website. The Account Name + Website Name are for your reference only. Enter in your URL making sure to set the http or https correctly with what you have. (How to get https for your site.) Next, choose a Category + Time Zone. It’s up to you whether you check the Data Sharing Setting checkboxes or not.

After filling in the details, check the “Get Tracking ID” button to be given your tracking code….after accepting the terms of service.

Copy + paste the Tracking ID + the Global Site Tag (aka the tracking code) into a doc so you can reference it later as you add your GA info to your WordPress site.

The ways to install Google Analytics on WordPress

Easy add: Plugin

To have Google Analytics on your WordPress website in 5 minutes or less, head to Plugins > Add New. In the search bar type Google Analytics + select this plugin by Jeff Starr. Click the Install button + let it do it’s thing. In a few seconds, the Install button will have changed to say Activate — go ahead + click that.

Now that the plugin is ready to go, head to Settings > Google Analytics. Click the Plugin Settings heading to show the GA Tracking ID field. In that text field, place your ID number + save the changes. that’s it, you’re done!

Moderate add: Theme script settings

Don’t want yet another plugin on your site? I get it + I applaud you! This second option is truly theme dependent, which means depending on what theme you’re using, this may not be a choice for you. But it’s worth a shot + if it doesn’t work out — you can try the advanced add technique below or the plugin route above.

Many WordPress themes have a spot in their settings area to add scripts or Google Analytics specifically. What you’re looking for is something like “Header Scripts,” “Footer Scripts” or “Google Analytics” in the theme settings for your active theme.

Once you locate that text area, paste in your Google Analytics tracking code (not just the Tracking ID) + save your changes. If the text field you find specifically calls for the number only (like the plugin option), then you won’t need the full tracking code.

The hardest part about this option is finding the option within your theme…if it exists.

Advanced add: Theme editor

If you’re comfortable making changes to your theme PHP files, you can add in your tracking code without needing to do any searching.

But make sure you are ok making changes here + that you are using a child theme. Otherwise you could break your theme or lose all of your changes when the next update is released.

Now that the warnings are out of the way, head to Appearance > Editor. Once there, locate your footer.php file in the right sidebar + click on it. When that file loads in the editor, locate the closing body tag (it looks like this ). Paste in your GA tracking code (again, not just the number) just before that tag.

Save your changes + refresh your site to make sure the footer loads properly.

Now what?

After you add in your Google Analytics code, you can head to your GA dashboard via the same link you created your account with to see the data roll in. Realistically you’ll want to wait for a few days to see any worthwhile data, but you’ll be able to see results in 24 hours or less!

From there, you’ll want to start analyzing your data as you make business decisions to know if you’re on the right track or not. If you don’t know where to start, check out this blog post to learn what numbers are the most valuable to online entrepreneurs.

on your keyboard hit enter to search or esc to close