Top Posts by Google analytics

Top Posts by Google analytics


April 13, 2018

Showing Top content on site is a common requirement most of the client request. In such case showing Top Post by Google analytics is the Best suitable option. But when I was going through with this, faced many problems.  In this Article, I will explain you my experience, Problem faced and Solution applied.

Find WordPress Plugin Alternative:

Solution for Top Posts by Google Analytics in WordPress:

After going through R&D I feel like there is no easy way in WordPress World to show popular post by Google Analytics. But suddenly my exploration put me in front of Google Analytics Post Pageviews

Google Analytics Post Pageviews:

This WordPress plugin links to your Google Analytics account to retrieve the pageviews for your posts. Therefore you can easily include this number in your blog for yourself or all of your visitors.

basically, this plugin is just to show post views, unique post views from google analytics.

but we can use it to show top post based on top post views and Unique post views noted by Google analytics.
this plugin updates a _gapp_post_views key in post meta table with value as analytics post view count.

we can use _gapp_post_views key to render WP_Query to show top or popular post of our site based on Google Analytics data report.

Top Post by Google Analytics Widget in WordPress

I have prepared code below to show top post based on Google analytics data grabbed by  Google Analytics Post Pageviews plugin.
You can paste this code in your theme functions.php and can check Top Post widget in widget section backend.

Leave a Reply

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