3 Simple Steps to Add Google Analytics to your WordPress Site

    Tahseen Kazi
Listen to this article

google-analytics-blog-imageThe one single parameter that is a success indicator for your website is the traffic it receives. And if you have done an awesome job at garnering a sizeable amount of relevant  traffic on your website then why not show it off to the world! This would not only let the world know about your popularity but also help you augment the already sizeable traffic on your website.

While the content that goes on your website should be of premium quality to keep pulling traffic, data like number of views a page has received, average time spent  by a user on the page etc will only just reiterate this quality and make readers keep coming back for more.

Data that you can Display after Adding Google Analytics to your Site

Before we go on to the ‘How to’ of adding Google Analytics to your WordPress website let us take a look at the google analytics data that we will be able to display on posts and pages once this has been done. So here’s a sneak peak!

  • Page Views: This data would give you the number of times a page has been viewed by visitors of the website.
  • Unique Page Views: Primarily this is the number of times a page has been viewed by unique visitors.
  • Visits: This parameter gives us the number of visitors that a site has received.
  • Entrances: This metric tells us how many of the visits to a specific page were also the first page seen in the session.
  • Average Time on Page: This parameter as the name suggests calculates the average time spent by users on a particular page.

3 Steps to add Google Analytics on your WordPress Site

So, now we have figured out how Google Analytics data on website posts and pages will be beneficial to our website. We have also got an insight on the data that we will be able to display on posts and pages of our website. But the real question that remains is how to actually display this Google Analytics data on either posts or pages of your website?? If that is a concern then do not worry, for I am going to take you through the entire process. We would primarily make use of the WordPress Post Analytics Plugin to display Google Analytics data on posts and pages on your website.

1. Obtain oAuth Credentials

  • The first step after you have installed the plugin on your website will be to obtain oAuth credentials such as Client Id, Client Secret, and API key. To obtain this you need to go on to Google Developers Console. Once here you will need to create a project.
Create New Project
  • Now, you need to enable the Analytics API.
Enable Analytics API
  • Once this has been done click on the Credentials option below APIs and auth in the left panel. You now need to create a new client ID and Create a New Browser Key.
Create New Client ID


Create New Browser Key
  • Once this has been done you will now have your Client Id, Client Secret, and API key as shown below.
Client ID, Client Secret and API Key Generated Using Analytics API
  • The data that goes in the Application Name field will be the same as product name field on the consent screen.
Set the Product Name in Consent Screen
  • All this data needs to be added to the admin dashboard and saved.
Add Data to Admin Dashboard and Save

2. Generate Token

  • Now that the Application Name, Client Id, Client Secret, and API key have been added and saved to the respective fields in the admin dashboard, a token needs to be generated. The option to generate this token will become visible to you in the admin dashboard once the Analytics API details have been added and saved from the admin dashboard.
Generate Token

3. Add Short Code on Page and Post

  • With token generation you are fully set up to start using the WordPress Post Analytics Plugin. Now you will have to add the [post_analytics] short code on every page or post that you need to display the Google Analytics data on.

Start using the WordPress Post Analytics if you want to display page views, unique page views, entrances, visits and average time on pages to the visitors of you websites. If your requirement is different from what the plug in has to offer then you can simply contact us for customizations.

Tahseen Kazi

Tahseen Kazi

Leave a Reply

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

Get The Latest Updates

Subscribe to our Newsletter

A key to unlock the world of open-source. We promise not to spam your inbox.

Suggested Reads

Join our 55,000+ Subscribers

    The Wisdm Digest delivers all the latest news, and resources from the world of open-source businesses to your inbox.

    Suggested Reads