Home > Help Center > Applications > WordPress > Add Google Analytics Tracking Code to WordPress

Add Google Analytics Tracking Code to WordPress

Google Analytics is a free website tracking service that reports website traffic, conversions, user behavior, and more. It is the most popular website tracking service available.

This tutorial is not about how to use Google Analytics, we'll only show you how to add the tracking code in your WordPress installation.

Implementing Google Analytics involves adding a JavaScript code to your site to collect data about each user's behavior on your site.

The tracking code must be installed on every page of your website so that it can gather traffic information for each site visitor.

The tracking code should be placed in the head section of each web page. Since WordPress assembles any web page from different templates, the availability of a separate template for the head section (header.php file) makes solving the task very easy.

But first, let's get the tracking code.

Get the Analytics Tracking Code

Create your own Google Analytics account following instructions on the site. Go to User Management and click on Tracking Code link:

wordpress google analytics

Copy the code on your computer.

Manually Adding the Tracking Code

Click Appearance > Editor:

wordpress google analytics

In the right hand side click on Theme Header link:

wordpress google analytics

In the code editor find the closing head tag </head> and just above it paste the tracking code:

wordpress google analytics

Click Update File button.

Now let's check if our code is properly added. Visit the site, but enter some meaningless string in the search field and click Search icon:

wordpress google analytics

We do this to be sure this is completely randomly generated page. You could try adding similar meaningless string in the URL to trigger 404 not found page:

wordpress google analytics

It does not matter which example you are following, now right click and select View page source (this is Opera browser, your menu will look different probably):

wordpress google analytics

Scroll a bit and you'll find around row 70 the successfully added tracking code:

wordpress google analytics

You Do Not Need Analytics Plugin

The quality of the WordPress site does not depend on the number of plugins used.

Use quality plugin only if the needed functionality is vital for achieving the site's goal and cannot be added by any other means.

The case with adding the analytics tracking code is far from vital if not provided by plugin so we stop here.


Google Analytics helps you to track many if not all important metrics on your site. You can monitor the effectiveness of your online marketing strategies, onsite content, user experience, and device functionality.

All these statistics show you what is working well, and more importantly, what isn't. Once you identify any issues your site may have, you can create a solution.

Google Analytics delivers the information you need to improve your website, and make it the best it can be.

#wordpress #apps

Still not finding what you're looking for?

Contact our support team with any additional questions or concerns.

Contact support