Plugin Directory

Test out the new Plugin Directory and let us know what you think.

Google Analytics Top Content Widget

Widget and shortcode to display top content according to Google Analytics. ("Google Analytics for WordPress by MonsterInsights" plugin requi

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 for WordPress by MonsterInsights" (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
  • 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.
  • 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)
  • thumb_size: Optionally display a thumbnail next to the post title (if the post has a thumbnail)
  • thumb_alignment: Thumbnail alignment -- only applies if specifying a thumbnail size

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 -
function gtc_add_viewcount_title( $pages ) {
    if ( ! empty( $pages ) ) {
        // loop through the pages
        foreach ( $pages as $key => $page ) {
            // and add the page count to the title value
            $pages[ $key ]['name'] = $pages[ $key ]['name'] . ' ['. $pages[ $key ]['value'] .' Views]';

    return $pages;
add_filter( 'gtc_pages_filter', 'gtc_add_viewcount_title' );

Feel free to fork or contribute on Github.

Requires: 3.0 or higher
Compatible up to: 4.4.7
Last Updated: 3 days ago
Active Installs: 1,000+


4.5 out of 5 stars


3 of 5 support threads in the last two months have been marked resolved.

Got something to say? Need help?


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