WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Google Analytics Top Content Widget

Widget and shortcode to display top content according to Google Analytics. ("Google Analytics Dashboard" plugin required)

Adds a widget that allows you to display top pages/posts in your sidebar based on google analytics data.

Requires a Google Analytics account, and the plugin, "Google Analytics Dashboard" (which will be auto-installed by this plugin, thanks to @jthomasgriffin's awesome TGM Plugin Activation Class).

Also includes a shortcode to display the top content in your posts and pages.

Shortcodes with options supported:

  • Companion shortcode to widget
[google_top_content pageviews=5 number=10 showhome=no time=2628000 timeval=2]
  • Display a post's/page's number of views
[google_analytics_views]
  • Conditional text where **count** will be replaced
[google_analytics_views]This page has received **count** views.[/google_analytics_views]

Shortcode attributes definitions:

  • Pageviews: Show pages with at least __ number of page views
  • Number: Number of pages to show in the list
  • Showhome: Will remove home page from list: (usually "yoursite.com" is the highest viewed page)
  • Time: Selects how far back you would like analytics to pull from. needs to be in seconds. (1 hour - 3600, 1 day - 86400, 1 month - 2628000, 1 year - 31536000).
  • Time Value: time=2628000 timeval=2 like in the example above would be 2 months.

Since 1.3:

  • titleremove: Remove site title from listings. (Unless your site doesn't output the site titles, then you will need to add this in order for the filter settings below to work.)
  • contentfilter: Limit listings to a particular post-type (post, page, etc)
  • catlimit: Limit listings to specific categories. (comma separated category ID's)
  • catfilter: Remove listings in specific categories. (comma separated category ID's)
  • postfilter: Remove specific posts/pages, etc by ID. (comma separated post ID's)

All of the widget options are exactly that.. optional. If you don't include them it will pick some defaults.

Plugin Features:

  • Plugin uses WordPress transients to cache the Google results so you're not running the update from Google every time. cache updates every 24 hours.
  • Developer Friendly. Many filters built in to allow you to filter the results to dispay how you want. One example of that would be to remove your Site's title from the results. (now unnecessary, as the widget/shortcode has the option built in) ** Example using a filter to add view counts after the title -
add_filter( 'gtc_pages_filter', 'gtc_add_viewcount_title' );
function gtc_add_viewcount_title( $pages ) {

    if ( !$pages )
        return false;
    // loop through the pages
    foreach ( $pages as $key => $page ) {
        // and add the page count to the title value
        $pages[$key]['children']['value'] = $pages[$key]['children']['value'] . ' ['. $pages[$key]['children']['children']['ga:pageviews'] .' Views]';
    }
    return $pages;
}

Requires: 3.0 or higher
Compatible up to: 3.8.3
Last Updated: 2014-8-7
Downloads: 10,144

Ratings

4 stars
4.1 out of 5 stars

Support

1 of 4 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1 100,1,1 100,1,1 100,1,1
100,1,1
100,1,1
100,1,1
100,1,1
50,2,1