How To Add Google Analytics To A Website

Sharing is caring!

Want to add google analytics to a website? It’s an easy peasy job that can be completed within minutes. 

If you want to set up Google analytics and understand the features without all the complexities, then you found this post at the right time.

Google analytics is an essential part of blogging that measures all your blog visitors behaviors and patterns.

You can use the metrics provided to improve your site.

In this blog post, I will show you how to add Google analytics to a website  from scratch plus show you how to use the analytics metric to improve your blog traffic.

What is Google analytics and how it works

Google analytics  is an analytics web service by Google that helps you to analyze your blog or website visitors in detail. It reports and tracks whatever visitors do on your website. 

This analytics  tool is very essential especially if you want to customise your blog or website to the needs of your visitors and most importantly to optimize your site for SEO.


For instance, if you want to know where your readers come from, what pages and posts they read, how long they stay on your page, etc.Google analytics will do that and more for you.

In order to get all these website metrics and for analytics to work on your site, you will need to insert a code in your page before it can start doing the tracking and reporting for you.

The truth here is because people do not want to be tracked without their knowledge, you will first need to have a privacy and disclosure page where you disclose how you collect visitors information by inserting a tracking code in your site.

You need to do that before you even think of setting up Google analytics on your blog ASAPly‚Ķ.(it’s that even a word? lol)

Is Google Analytics free?

Google analytics is free. The only thing you will have to give in return is to share your data and that of your blog visitors data to Google.


To setup Google Analytics, you will need to signup as you would with any other email newsletter.

It’s easier if you are using your Gmail account to browse the internet on chrome. Here is how to signup for Google analytics 

  1. Go to
  2. Click on start measuring
  3. Enter your Gmail address and password or create one if you don’t have.
  4. Click on signup

That’s it. You are all ready to add your website to Google analytics.

Adding A Website to Google  Analytics 

After signing up for analytics, you will be directed to your dashboard where you will be doing the following settings 

  •  Account setup
  • What you want to measure
  • Property set up

I will take you through all of that.

Google analytics  Account set up

#1.  Enter a new name for your account and click next

You will need to give a name to the account first before continuing the whole setup process. Click the next button to choose what you want to measure.

#2. Select the web option and click next

Choose the web option in the “what do you want measure section”. Click next to get the property setup page.


In the property set up page make sure to do the following 

  • Fill in a website name
  • Insert your website link. If you have SSL setup, change the http to https. You can do that by clicking on the http option.
  • Select your website industry
  • Select the time zone that you want the tracking code to report
  • Click on create

An agreement form will popup for you to accept before you can get the tracking code to add to your site.

Change the agreement country to your home country. By default the country is set to United States so you may want to change it to yours.

After agreeing to analytics terms and conditions,  another screen will pop up asking you if you will like to receive email alerts from analytics. 

You can choose to click on ok or not your choice to make. 

Your Google analytics account is now created.

Adding Tracking Code in Google Analytics to your website

Our next step will be adding a tracking code to your Website in the header.php of your theme. 

I strongly advise against touching your theme’s code. Should there be any theme update, you will lose the code and honestly, most people tend to forget to re add the tracking code.

To be on the safer side, I recommend you install the header and footer plugin here. 

You will just grab the code and paste it in the head section in the plugin. 

Easy right?


Where is the tracking code in Google analytics 

The tracking code in Google analytics is found in the tracking info settings  found under property settings

After setting up your account, a new screen like the image below will pop up.

Image from Google

Copy all the tracking code in the box. You will then paste the code in the header section of your site. 

As I said early on, we will use the header and footer plugin to install the code instead of pasting it in your theme’s header.

If you have not installed it please do so.

Here is how to install the tracking code in Google analytics to your site.

  1. Navigate to your dashboard and click on the menu icon
  2. Click on settings 
  3. In the settings menu, scroll down and select Insert headers and footers
  4. In the scripts in header section, paste in the code you copied from analytics 
  5. Click on save changes.

You now have your tracking code in Google analytics fully installed on your site.


There are several google analytics plugins for WordPress. But I personally don’t like it as it terribly slows down your site. I strongly advise against it so I won’t include it in the tutorial here.

You can also download the app for Google analytics to your phone for easy access to your analytics dashboard. It’s available on playstore and Apple store.


Navigate back to your Google analytics  dashboard and click on the home icon on your left. You will see your analytics dashboard like the image below.

It will take roughly an hour or a day before it can start working properly.  Mine took a day if that makes you feel better.

Now that you have all settings in place let me explain some of the analytics jargon you will see on your dashboard.

Google Analytics Dashboard Explained

Your Google Analytics dashboard is where everything about your visitors can be found. 

The posts they read, pages visited, how long they take on your blog, the countries they are visiting and so many metrics can all be found on your dashboard.

I will first start with  the menu panel on the left of your screen. I will explain what each term does and measures excluding the “home” for obvious reasons.

Google analytics dashboard  menu


This where you can customize the metrics that you want to see on your dashboard. You can even use customized templates from other analytics users.

The customization panel has the following sub menus

Dashboards: For creating a template for reports you want to see. See how to create analytics template here

Custom Reports: specific reports you want to get your hands on quickly. 

Saved Reports: Save reports for easy analysis.

Custom Alerts:  You can create alerts for sessions, keywords,users etc.

I personally use a dashboard template from analytics to help me get information quicker.


Real time in Google Analytics allows you to view the number of visitors live on your website. You will be able to view the countries that they are reading from, the pages they are visiting, mobile devices they use etc.

Under the real time settings, you will find another sub menu. I will explain the basic ones.

OVERVIEW: General information of your real time visitors like the country, active page, traffic referral, social traffic and keywords.

Location: Specific locations they are reading from.

Traffic Sources: Get to know how your readers landed on your blog. If it is organic that is, straight from search engines or from Social media.

Content: Posts and pages they are reading.


In the audience section you will find other sub sections. As usual, I will touch on the basic ones you will need as a beginner.

 I don’t want you to feel overwhelmed.

Active Users: For finding the number of active users in 1 day, 7 days or 14 days. You can check he number of users the previous day,last 7 days or 14 days.

Overview: The overview under audience gives a general analytical insight like the number of users, sessions, Average sessions duration or page views per person etc.

Lifetime Value: Finding the number of organic, social, direct and referral visits you have had since you started your website.

User Explorer:The user Explorer in analytics shows the behavior of individual users on your site. For instance, the number sessions a specific user does on your site.

Demographics: For identifying the age and gender groups who visit your site.

Interests: The interests section is used for finding what your visitors are interested in when they are online.You get to see if they are interested in shopping, beauty products, finance etc in the affinity categories.The In-market segment also tells you what products your visitors are likely to buy. If you are into affiliate marketing, this will be a great metric to use. The In-market segment also tells you what products your visitors are likely to buy. If you are into affiliate marketing, this will be a great metric to use.Other categories show other things users may slightly be interested in  like travel and entertainment, art, events etc.

Geo: Use these metrics to find the language your visitors speak and their location.

Behavior: Compare your new visitors to your returning visitors using the new vs returning metric.  Find the frequency of a user on your site and the last time visitors visited your site in the frequency and recency metric.

Engagement: For finding out your user engagement sessions duration on your site. It shows session duration metrics on your site. That is, how long they stay and other pages they interact with.

Technology: Find the search engines your users use via the browsers and OS metric as well as their networks in the Network metric all under technology.

Mobile: Devices visitors use to visit your site. To find the exact device select the devices metric under mobile.

These are the metrics under Audience I feel are basic enough to follow.


Acquisition shows all your audience  traffic sources.  

View the channels your audience use to visit your site through the all traffic section. To find the exact source of your audience  acquisition, click on the sources or medium under all traffic.

Social: Social helps you discover where your social traffic originates. Your Facebook,  Pinterest, Twitter, Instagram,etc. traffic will show there. 

Campaigns: The campaigns  section shows the keywords people use to land on your page.There is the paid keywords and Organic keywords.

 If you run ads on Google, the paid keywords users used to land on your site will show. Again, the organic keywords can also be viewed via the organic keywords section.

 If you want to improve your SEO with Google analytics,  your best bet is to view the organic keywords section. Include the keywords visitors use to land on your page to boost your traffic.


Behavior in Google analytics shows  what your users do when they land on your site. Social media examiner explains this better than I do so click on the link to read more.

Site content: See total number of Pageviews sessions, unique visitors etc on all your pages in all pages under site content. You get to know the top pages driving traffic to your blog via the Landing pages.

Content drill down: This is where you get to see individual Pageviews on your pages. Here, you view pages that are doing well or not. With this information, you can analyse and work on how best you can improve views.

Site speed: Check how long it takes for your site and individual  pages load time. Google hates slow pages.


When you install the code it doesn’t block you from tracking your own activities on your blog. 

I was so excited when I started getting views on my first blog and when I went to check the pages and posts people had visited, I saw that most of them were from my wordpress login ID and my post previews. (Smacks forehead)

Honestly,  it killed my excitement when I found out my skyrocketing page views were all mine. 

You certainly don’t want to have that ego deflating moment when it comes to your first encounter with analytics. 

That is why you will want to block your blog activities from analytics because you will want to have accurate results and that means your page views should be excluded.

How To Block your own views from Analytics 

There are several views of your own you will need to block. We will be blocking your views from these 4

  • Filter your IP address
  • Filter post previews
  • Filter admin login.php
  • Filter admin /wp-admin/

Most times, blocking your  IP address works for all. But if it does not work you can use any of the blocking tutorials below.

How to Exclude Admin IP address  from Google Analytics 

First, you will need to retrieve your IP address. To know your address, go to Google and just type  “IP Address”. Your IP address will be shown. Copy the number . We will use that later in our tutorial. 

Google analytics admin dashboard
  1. Navigate to your analytics dashboard 
  2. Click on the settings icon on the left corner of your analytics menu 
  3. In the view settings, click on filters.
Google analytics filters dashboard
  1. Click on add new filter(red highlight on the left)
  2. Give your filter a name(purple highlight)
  3. In the filter type leave it as “predefined”(blue highlight)
  4. Click on select filter type and choose “Exclude”(green highlight)
  5. Click on select  source or destination and choose” traffic from IP addresses”(yellow highlight)
  6. Click on select expression and choose “that contain”(gold highlight)
  7. Paste the IP address you copied into the IP address box.
  8. Click on save.

Go back to your website to see if your settings worked or not. If it still tracks your activities on your blog, you should follow the other blocking procedure. 

Block Google Analytics from tracking your admin.php activities

  1. Go to analytics dashboard settings
  2. Select filters from the view menu
  3. Click on add filter
  4. Give your filter a name
  5. Select custom for filter type
  6. Click on filters field and select Request URI
  7. Enter this expression “wp-admin.php”
  8. Click on save.

BLOCK Google Analytics from tracking your post previews 

  1. Navigate to your analytics dashboard 
  2. Select filters from the view menu 
  3. Click on add filter 
  4. Name your filter
  5. Select custom filter for filter type
  6. Click on the filters field and select “Request URI” 
  7. Enter this expression “preview=true”
  8. Click on save 

Block views from /wp-admin/ in Google Analytics 

  1. Navigate to your analytics dashboard 
  2. Select filters from the view menu 
  3. Click on add filter 
  4. Name your filter
  5. Select predefined  filter for filter type
  6. Click on select filter type and choose “Exclude”
  7. Click on select  source or destination and choose” traffic from subdirectories”
  8. Click on select expression and choose “that begin with “
  9. Enter /wp-admin/ in the filter box
  10. Click on save.

How to block analytics tracking code from tracking blog admin activities using a chrome extension 

This is so far the easiest way to block analytics from tracking you while you are on your site. Since its only available on desktop, it wouldn’t work if you use your mobile.

  1. Go to chrome/Safari/Firefox store 
  2. Search for block yourself from analytics 
  3. Click on Add to get the  extension downloaded
  4. Add your website or any other site you wouldn’t want to be tracked to the extension 

If you follow any of these steps, I assure you Google will provide accurate page views without including yours.

Basic Key Terms On Analytics Dashboard 

Pageviews: The number of pages a user visits

Sessions: It’s the individual time or period a user spends on your site. It normally ends after 30 minutes of inactivity.

Unique Pageviews: This counts the number times a page is viewed in an individual session per visitors. 

Unique Visitor: A visitor visiting your site for the very first time.

Bounce Rate: It counts a visit with just one page view no matter how long they stayed on a page.


Congratulations on setting up Google Analytics.

 If you want to improve your site  and increase blog traffic, then you should make good use of the metrics analytics provides. 

When interpreted correctly, Google analytics can be a powerful tool for your blog’s success.

Remember this: Coca cola sold only 25 bottles in their first year. Don’t give up yet!

I hope this post has been helpful to you. If you have any suggestions to improve this post, I will be glad to know. Just leave it in the comments section.

If this post was helpful to you, kindly share and pin image.

Add google Analytics to a website

Recommended Posts

Leave a Reply

Your email address will not be published. Required fields are marked *