The 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.
- Now, you need to enable the 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.
- Once this has been done you will now have your Client Id, Client Secret, and API key as shown below.
- The data that goes in the Application Name field will be the same as product name field on the consent screen.
- All this data needs to be added to the admin dashboard and saved.
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.
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.