How To Setup Google Analytics On A WordPress Site (3 Different Ways)


Please raise your hand if you’ve ever felt personally victimized by Google Analytics.

When you open it up for the first time, you’re hit with a page full of text and your mind suddenly goes blank. You don’t know what to do next so you just sit there and wonder. Never mind that- we will walk you through how to set it up on your wordpress site in this very blog post. When we are done you’ll know exactly how to setup Google Analytics on your wordpress site.


Let’s dive right in.

What In The World Is Google Analytics And Why Do We Need It?

Google Analytics is a great tool that helps you measure how well your website, blog or your company is doing on the internet. It gathers vast amounts of data and allows you to get right to the core of what’s successful and what isn’t.

Knowing and understanding your audience and what they want is a major success factor for any website. The best way to know your audience is through your traffic stats and this is exactly what Google Analytics provides for free. There are plenty of other stat softwares and plugins  like Google Analytics available for free, but Google Analytics is a must have for every blog as it is the most powerful that you can get for free.

Google Analytics shows you:

  • Who visits your website
  • What they do on your website
  • At what time they visit your site
  • Where do they arrive at your site from
  • Analytics also shows you the breakdown of each traffic source
  • And much much more

Let me guess what you are thinking right now… You want Google Analytics up and running on your site right now! Am I right?

Setting Up Google Analytics On Your WordPress Site In 5 Steps

#Step 1 – Signing In

The first step to having Google Analytics setup on your wordpress site is to create a free Google Analytics account. To do this, you will need to visit the Google Analytics Signup Page and login.

Once you reach the page above, you will see a screen like the one shown below. If you have a Google Email(Gmail) account, then use that to sign up Google Analytics with. If you do not own a Gmail account, you will have to create a new account yourself and then join Google Analytics.

#Step 2 – Signing Up For Google Analytics

Once you sign-in with your Gmail account, you will be prompted to a screen like the one below. This is where you will sign up for Google analytics with your Gmail account.

If you are not prompted to a screen like the one shown below please click here to be taken there.

Google Analytics - 2

Once you reach this page, click on the button which says Sign Up, which is on the very right.

#Step 3 – Chose Tracking And Enter Your Information

On the next screen, you will be given choice to choose between website or mobile app tracking. Make sure website is selected.

Google Analytics - 4

After choosing the website option, enter your Website’s URL, Account name (it can be of your choice – anything you like), country, and the time zone. The information is quite self-explanatory.

  Google Analytics - 7

*Note: Do not change the Data Sharing Settings. Keep them as they are!*

Once you have entered the information shown on the page, click on the Get Tracking ID button. You will be presented with Google Analytics terms and service which you must agree to, so click on the I Agree button.

#Step 4 – Copy The Tracking Code

Now you will be presented with a Google Analytics tracking code. Copy this tracking code because you will need to enter it in your WordPress site.

If you can’t see the tracking code, click on the Admin panel on the top of the page,

Google Analytics - 5


and then click on the tracking info option which is the Property column.

Google Analytics - 6


Inside the tracking info option, click on the Tracking Code button. Once you click on the button, you be taken to page which has your tracking code on it.

After you copy the code, keep the tab open.

#Step 5 – Installing Google Analytics On Your WordPress Site

There are 4 ways to install Google Analytics into WordPress: Plugins Installation(the most recommended), Direct copy and paste, and editing the functions.php file(the least recommended). Some themes also offer an option where you can insert code into the header/footer of your website in the theme’s theme options, and you can paste it there easily.

Plugin Installation:

There are tons of plugins available to add Google Analytics to your site. Install plugin which allows you to insert a code into the header of your site (e.g. Insert Header and Footer), or a plugin which is specially made for Google Analytics (e.g. Google Analytics by Yoast).

Direct Copy Or Paste:

Copy the code that you received in Step 4, and paste it in your theme’s header.php right after the <body> tag.

Editing The Functions.php File:

Add the following code in your theme’s functions.php file and don’t forget to paste your Google Analytics code from Step 4 where it says “Enter Your Google Analytics Code Here”.

add_action('wp_footer', 'add_googleanalytics');
function add_googleanalytics() { ?>
//Enter Your Google Analytics Code Here
<?php } ?>

Once you have installed Google Analytics onto your site, you can go back to the screen from Step 4 and click save.


Last but not certainly the least, you want to click on the Reporting tab to see your site’s analytics overview. It takes Google up to 12 – 24 hours to start providing you with the stunning site stats that you need.

Then you are ready to start tracking your visitors and start raking in the leads and customers.

And you know what the best part is? Next time, installing Google Analytics won’t feel quite as daunting. 🙂

Google Analytics is a must have for anyone and everyone. If you have any questions, feel free to ask them in the comments section below.


This post is a guest post by Vatsal Savani, an internet fanatic, web designer, a professional freelance writer, and a friend of mine. He blogs at about Making Money Online and Blogging.  You can get his new course on how to become an Interneteer in 14 days here. Don’t forget to send him a line on twitter @theVatsalSavani.


Related Posts

About The Author


Add Comment