Support » Plugin: Google Analytics Popular Posts » Great plugin, but needs improvements

  • We were not able to find any other plugin which would fetch the post hit counts from Google Analytics and store it in such way that it’s easy to associated for each post.

    Couple of issue though:

    1) Setup of Google API tokens misses any instructions, I had to use this guide to figure out how to set it up:

    2) Setup of Google API tokens is fragile. No way of reseting it if something goes wrong, I had to remove the “analyticbridge_access_token” wp_option by hand.

    3) Drop down menus associtad with picking of “Property View ID” don’t reflect the actual property you select, but the value in the text field is correctly stored.

    3) It was not working if there was some URL which couldn’t be translated to a post ID, I had to fix that, as the plugin was generating invalid SQL insert in that case.

    4) Only works with data from last 2 days, we would like last 31 months.

    5) This plugin could be a powerful replacement of the Jetpack Stats module. We would like to create a bridge, so that Jetpack compatible themes can use the data from this plugin rather than having to use Jetpack.

    We would like to discuss these improvements with you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author The INN Nerds


    Hi Martin –

    Thanks for those suggestions!

    On all the Google API stuff, we think there was a change at some point that broke a bunch of that so we just need to take some time to revisit that and see what needs to be tweaked to work with whatever the new version of the API requires.

    The URL not mapping to post ID issue is a new one (to us). Can you give us a little more detail on that or maybe open a github issue so we can track and hopefully resolve that?

    Re: only storing data for two days, we were originally keeping the data around forever but found that for even medium-sized sites the db got huge very quickly so we decided to limit it to just the past couple days because that’s really all that’s used for the calculation of which posts are the most popular in a given time period. If you wanted to do other things with that data, then yeah, you’d definitely want to keep it around longer and we could probably make that option filterable in the plugin, just with the caveat that you’d want to keep a close eye on the size of that table to make sure you don’t run into major performance issues.

    Not sure if you have the time/energy to contribute to the plugin directly, but we’d definitely welcome that if you’re willing/able to hack away at any of these issues.

    Thanks again for the review and the suggestions!


    • This reply was modified 4 years, 2 months ago by The INN Nerds.
    Thread Starter FolioVision


    Hello Adam,

    sorry about the delay, it was a busy month.

    Great that you are able to fix the Google API connection.

    I create a new pull request with my changes:

    1) Fixing SQL generator when url_to_postid() returns 0 – sometimes url_to_postid() retuns zero, in which case you still append coma symbol:

    if($iter->hasNext()) {
      $pagesql .= ", \n";
      $metricsql .= ", \n";

    2) Increased the stats from 2 days to 90 day – we added some control variable which allowed us to scan last 90 days of activity to gather historical data, but I see this code could be removed now:

    But I would suggest you keeping the stats forever and only code some function which merges the daily data into weeks or months for old entries. That would be perfect and would prevent the db from getting big.

    3) Adding stats_get_csv() to replace Jetpack stats – we wrote this as we wanted to help our client get rid of JetPack as that’s just too much code and it was slowing down the website. If you decide to put this code into your plugin, you should be making sure it only runs if JetPack is off to prevent comaptibility issues, as what we did uses the same function name (stats_get_csv()) so it tries to disable the JetPack stats module first.

    4) Adding quick stats view to the options screen – something we added to be able to see how it all works:


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Great plugin, but needs improvements’ is closed to new replies.