How to Set Up Google Analytics on WordPress

Google Analytics is the best tool to analyze the traffic that comes to your website. You can see where your traffic comes from, how users are accessing your site, what pages they go to, and how long they stay on those pages. Being able to use Google Analytics effectively can give you the insight needed to generate revenue and leads from your site.

Adding Google Analytics to your WordPress site is relatively easy. You have two options for adding it to your site.

Adding the Google Analytics Code without a Plugin

Before you do anything, backup your site. Whenever you make changes to a WordPress website, you should back it up in case anything goes wrong.

Once that is done, you can head over to Google Analytics to get your tracking code.

Log into Google Analytics using your GMAIL username and password attached to the website. You will then need to click on Admin and then Tracking Info.

Look for Tracking Code, and then click on that. You will see a Tracking ID that starts with UA.

Under that, you will see “Website tracking.”

Highlight the code in the box, and copy it (ctrl+c).

Now, you’re ready to go to your WordPress site. Click on Appearance>Editor>Theme Header.

Look for the <body> tag in your header.php. Paste the Google Analytics tracking code after it.

All you have to do after pasting is click Update File.

You can test that the code is in the right place and working by going back to your Google Analytics tool. Proceed to the same place where you copied the code, except at the top click on “Send test traffic.” Wait a few seconds and watch to see if the message under Status says that you have one active user. If it says that, it’s working!

Adding the Google Analytics Code with a Plugin

You have many options for Google Analytics WordPress plugins. These are my favorites:

Google Analytics by ShareThis

Google Analytics for WordPress by MonsterInsights

Google Analytics Dashboard for WP by ExactMetrics

Each one does the same thing, so pick the one you like the best after reading the descriptions.

I could go through the instructions of how to enter the tracking code into the plugin, but it’s pretty self-explanatory once you install the plugins. You basically go into the settings for the plugin and you should see where you need to enter the tracking ID.

The tracking ID is different from the tracking code that you would use in your header.php. The tracking ID is the UA-number you see first under Tracking Info in Google Analytics. Most of these plugins provide you instructions on where to find it, so follow that to know for sure where to get yours.

You can test whether the plugin placed the tracking code on your site by going back to the Google Analytics tool’s Tracking Info section. Click on “Send test traffic” and wait for it to show you the status that there is an active user.

Google Analytics Is Important

Google made a tool available that gives you information about the users on your site. Use it. The information can help you improve your site for better rankings, more traffic, and increased conversions. Get the tracking code or ID installed in your WordPress site now, or contact us to help.

Avatar photo
TWC Editorial Team

The Webmaster Company Editorial Team shares and creates content for the web industry and shares it here with you first, free.