Does anyone know of a wordpress plugin or widget that uses Google Analytics to display the page views to the user of the page they are on?

The reason it need to integrate with google analytics is that I have page views from existing posts that I wish to be counted and the normal page view plugins don't show the historical views.

  • Not really sure what you are asking, if you have Google Analytics tracking activated you can drill down to page views/post views in the Analytics dashboard
    – Vince P
    Aug 6, 2012 at 7:52
  • I'd like the views to be shown in single page/post view, single.php Aug 6, 2012 at 7:56
  • So you want to show how many views that page or post has had to all users?
    – Vince P
    Aug 6, 2012 at 8:35
  • 1
  • 1
    Why specifically from GA... if you can achieve the same result then why not use one of those?
    – Vince P
    Aug 6, 2012 at 9:01

2 Answers 2


Please check out the WordPress Post Analytics Plugin that we (WisdmLabs) have created.

http://wordpress.org/extend/plugins/wordpress-post-analytics/ This is available on the WordPress plugin repository as a free download.

We link your Google Analytics account to the plugin and pull data from the Analytics backend to showcase stats right inside any post. You have a choice of using shortcode or a template code snippet to embed the plugin on your website.

Feel free to let us know your feedback on the support forum or through our website.

  • You might want to make this compatible with 3.6. Oct 1, 2013 at 16:17
  • no longer updated and valid for downloads Jan 18, 2019 at 9:18

You could do something like the following (merely an example, do not take literally):

$posts = get_posts( 'posts_per_page=-1' );
foreach ( $posts as $post ) {
    $url = url_encode( get_permalink( $post->ID ) );
    $get = wp_remote_get( "https://www.google.com/analytics/api?visits_for_url=$url" );
    if ( $data = wp_remote_retrieve_body( $get ) )
         update_post_meta( $post->ID, 'analytics_view_count', $data );

This process would then run as a daily/half-daily WP cron event.

I have zero experience with the API, so how you query data by URL, or as to what data types are returned, you'd need to read up on the documentation.

I would also assume that it has a query limit - you might need to throttle the process, or at least break it up into batches (perhaps the latter, especially if you have a large number of posts).


Not the answer you're looking for? Browse other questions tagged or ask your own question.