Way to Configure Google Analytics Tracking Code in WordPress

It’s hard to imagine a stronger connection than WordPress+Google. If you are running a WordPress based website, then pairing it with Google Analytics is a must. And while there are several methods you can integrate Google Analytics functionality into your site, today we’ll mainly concentrate on adding and configuring Google Analytics tracking code in WordPress.

Sometimes website owners spend all their possessions and time on driving as much traffic into their websites as possible, but fail at tracking the success of their endeavor.

But the truth is that keeping the track of the whole process, understanding the behavior of your web visitors, the channels through which they are landed on your site, the time they spend on it is as of paramount importance as well if you want to have stable results in the foreseeable future.

This is where Google Analytics comes as a real magic for WordPress website owners. It is going to provide you with tons of useful information and data showcasing how your audience interacts with your website in general and at the very moment.

As mentioned below, there are different ways you can connect your site with Google Analytics. One of them is to add and configure Google Analytics tracking code in WordPress. At first glance, this method may seem somehow tricky especially for the beginners, as it has to do with little coding.

But if you keep reading our article, you will find sever steps to follow and succeed in adding the needed tracking code directly to the theme your website uses. Believe us, all your efforts will be paid off!

Way to Configure Google Analytics Tracking Code in WordPress

Add Google Analytics Tracking Code in WordPress

Step 1. Create a Google Account:
Naturally, to get started with Google Analytics, you need to have a Google account. If you already have one, then simply log in to your account and pass on to the next step.

Step 2. Log in to Google Analytics:
The next step is to sign into Google Analytics by following the link above. Choose your gmail address and log in.

Step 3. Find the Tracking Code:
Once you are logged in to Google Analytics, you will need to find a tracking code to be added to your site manually.
Go to the admin area in the left taskbar inside Google Analytics, where you will find 3 columns of admin settings. Find “Tracking Info” in the middle column (property column) and then choose “Tracking Code”.

Step 4. Copy your Tracking Code:
Now, you can get your unique tracking ID along with Universal Analytics tracking code under “Website tracking” section. Copy the tracking code in full.

Step 5. Go to your WP Admin Dashboard and Add Google Analytics Tracking Code in WordPress:

Log in to your Admin area and navigate to Appearance, Editor. On the right of the screen, you can see the site’s files like Theme Footer (footer.php), Theme Functions (functions.php), Theme Header (header.php). Each of these file’s code will be displayed in the middle of the screen.

In all probability, you may want to add Google Analytics tracking code in WordPress in the way that the whole website and not certain pages of it is tracked. Then, the file you will need is header.php.

Open the file and paste the previously copied code after the tag. Once the code is added, update the file and save it.

Finished! You are now done with adding Google Analytics tracking code in WordPress.

Step 6. Wait for the Google Tracking to Work:
Google advises you to wait 24- 48 hours before trusting any data information you will find in your website. So you need to wait for 1-2 days before following the tracking of your site.

But what you can do at this very point is to check whether the desired connection has been established between Google Analytics and your WordPress website to be sure Google will start tracking the site soon.

Go back to Google Analytics’ Tracking Code page and find “Status Update” to the right of Tracking ID. Click on “Send Test Traffic” to check whether the connection is set. Your site will be opened in a small window.

If everything is ok, Google Analytics account will update to show 1 active user. The process may take up to a minute, so you will need to wait a little.

Note. Before tweaking your theme’s files, be sure you have created the child theme for your WordPress website. Hence, before adding Google Analytics tracking code to your site, be sure you have a child theme already created.

Add Google Analytics tracking code in WordPress with a Plugin:

1. Head, Footer and Post Injections:

header footer

download button

If you don’t want to add the tracking code manually and are looking for a plugin that will do it instead of you, Head, Footer and Post Injections is what you need.

All you need to do is to copy the code from Google Analytics and paste wherever needed with the help of this plugin. As for the technical part, the plugin will do the job itself. The advantage of Head, Footer and Post Injections is that you are free to change your WP theme any time you want without losing the codes added.

2. Insert Google Analytics’ Tracking Code:

Another useful plugin to make the process of adding GA tracking code to your site is called Insert Google Analytics’ Tracking Code. Simply copy your Universal Analytics Tracking ID from Google Analytics and paste it into Settings, Google Analytics, Tracking ID.

Save the settings and let the plugin to insert the code to track and analyze the visitors of your WP site.

Let’s start off with the most important step, make sure that you choose WordPress as your platform for your website and select from one of the many available WordPress themes; check out some of our free themes and premium ones to get a better idea of what’s available.

Since you are just planning to set up your website, then there are a few things that you need to know – having Google analytics in place will enable you to track your website’s current metrics and will enable you to gauge who’s been visiting your website, and even get a read on their current location.

That’s why it is essential for you to make sure that you configure Google analytics tracking code in WordPress; this will enable you to track all incoming traffic and even determine where the traffic is coming from and tweak your marketing strategy accordingly.

The process to set up Google analytics tracking code in WordPress is fairly easy; you should be able to get it done in a matter of minutes.

Of course, you could well wonder if it is worth the time and effort to configure Google analytics tracking code in WordPress. Imagine this, you have a marketing strategy in place, you have an ad words campaign and you are finally getting some traffic.

That’s all good but how would you know as to how well you are doing, really? Can you calculate the incoming traffic?

Do you know where they are coming from or as a result of what marketing strategy that you have in place? If you have responded in the negative to all of the above or even some, then you need to know that having Google analytics in place can help you to do that and a lot more.

Just read on to learn how to install the same in a few easy steps.

• Create a Google account: The first thing that you need to do is to create a Google account; you will be using the same for multiple purposes and set up your email id, it will be your primary mail id.

• Google analytics: Keep your Google account open and log into Google analytics; once you are logged in as head over to the admin area, and you should come across three columns where you should find the “tracking info”.

Now, select “tracking code” and this should provide you with more choices, and at this point, choose website tracking for that’s the one you need. You need to copy the tracking code in full; just highlight the section and press Cntrl+C and that should do the trick.

• WordPress: Now log into your WordPress account and head over to admin, and then to appearance, editor. This should display several items on the right including footer, along with functions and header; the code for these would be displayed as well.

All you have to do is to open the header file with header code and add the copied tracking code and you’re all done. Remember to click on update and save the required file, now you have successfully added Google analytics to track all your pages.

With Google analytics in place, you should be able to tweak and optimize your marketing strategy so that you are able to gain an edge over your competition.

Summing up:
We hope this article helped you understand how you can add and configure Google Analytics tracking code in WordPress. This will definitely contribute to a more fruitful tracking of your site and its visitors to see the most popular pages, time people spend on your site, pageviews and bounce rate, social overview, benchmarking and more.

About Sonl Sinha

Sonl SinhaSonl Sinha is a passionate writer as well as WordPress and WooCommerce rockstar who loves to share insights on various topics through his engaging blog posts. He runs a successful website design and digital marketing company. With 15+ years of experience in WordPress theme development, he strives to inform and inspire readers with his thought-provoking content. He helps thousands of small and medium businesses and startups create a unique online presence. Follow Sonl Sinha for your regular dose of knowledge and inspiration.

Do check out our free WP themes and WordPress themes bundle