Google Analytics Top Content Widget Wordpress Plugin - Rating, Reviews, Demo & Download

Google Analytics Top Content Widget Preview Wordpress Plugin - Rating, Reviews, Demo & Download
5 Average out of 5 ratings
Free
Follow for free plugins, new theme releases and theme news

Plugin Description

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.
  • 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
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;
}

Feel free to fork or contribute on Github.

Screenshots

  1. google-analytics-top-posts-widget screenshot 1

    Widget options.

  2. google-analytics-top-posts-widget screenshot 2

    Widget display (in an ordered list).


Reviews & Comments