How to Install Google Analytics In WordPress

How to insert google analtics into a wordpress websiteIn this article, we will explore Google Analytics.

Google Analytics is a free tool from Google. It gives you detailed information about your site’s visitors. This information is very important for you. By utilizing this information, you can analyze your visitors in depth and construct a strategy to improve your WordPress website.


By using Google Analytics, you may obtain valuable information about your audience like;

  • Geographical data (their countries and languages)
  • Behaviour (new or returning visitor, engagement time, count of sessions)
  • Interests
  • Demographic data (their age and gender)
  • Technology (browser, operating system and network)
  • Mobile devices (which mobile device they use)
  • Users flow (their surfing pattern on your site)
  • Active users

And about your website like;

  • Landing pages (The pages which visitors entered your site)
  • Impressions, clicks, CTR (click through rate), average position
  • Sessions and bounce rate
  • Devices used (desktop, tablet, mobile)

The information you may get from Google Analytics is not limited to the above list. It is a complicated and powerful tool so it might take some time to be able to master it.

Now, let’s begin to install Google Analytics to your wordpress website step by step;

Step 1

To be able to use Google Analytics, you will need a Google Account.

If you do have one, then you may immediately skip to step 2.

If you need a Google Account, you may read this article about how to get a Google Account or go directly to Google page to open a Google Account.

Step 2

Open Google Analytics page and sign in (on the upper right hand side) just by following the instructions. There is nothing special about the questions, they are pretty self-explanatory.

Step 3

Log in to Google Analytics.

Now, you will “set up a property”

Click Admin

Choose your account (This is the account which you want to add a property. It is inside a drop down menu at the upper left hand side)

Choose “Create a new Property” from the Property drop down menu (middle column)


 For the “What would you like to track?” question select “Website”

How to Install Google Analytics to WordPress

Type your “Website Name” and “Website URL”

Choose your “Industry Category” and “Reporting Time Zone”

Click “Get Tracking ID”

Accept “Google Analytics Terms and Service”

You will see the Universal Analytics tracking code for the property that you identified.


Now, you will copy and paste this code into every webpage to be tracked.

Step 4

Copy the tracking code.

Log in to your WordPress Dashboard.

Click Appearance and choose Editor.

Choose your current theme and click Select

Select Theme Header file (header.php)

Ctrl+F (to find the body tag inside the php code) and type “<body” (do not type <body> just type <body)

Now you located the place of <body> tag.

Paste the tracking code right after <body> tag.

Update the header.php file.

You are done !


After a few days, you will be able to see and examine your Google Analytics data.

You can also combine Google Search Console (which is another very useful free tool from Google) with Google Analytics.

To learn how to do this, you may read A Beginner’s Guide to Google Search Console

Tolga Ayan

Writes articles about WordPress, CSS & Related Web Technologies. Resident of Alpharetta, GA.

We'll be glad to hear your comments !