koko-analytics icon indicating copy to clipboard operation
koko-analytics copied to clipboard

Feature suggestion: Show pageviews column on post/page overview pages

Open svatoupravdu opened this issue 4 years ago • 7 comments

I'd love to see Hits column in admin post/page list just to have brief overview on how many times the articles have been read. WP Statistics plugin has such feature, just simple numbler would be enough, chart in column is not necessary.

screenshot-wp-statistics com-2018 12 04-16-14-56


Please vote on this feature suggestion using :+1: or :-1: below.

svatoupravdu avatar Apr 05 '20 06:04 svatoupravdu

Hmm, interesting. For what time period are those hits though? Should it be configurable from the UI?

Verstuurd vanaf mijn iPhone

Op 5 apr. 2020 om 08:59 heeft svatoupravdu [email protected] het volgende geschreven:

 I'd love to see Hits column in admin post/page list just to have brief overview on how many times the articles have been read. WP Statistics plugin has such feature, just simple numbler would be enough, chart in column is not necessary.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

dannyvankooten avatar Apr 05 '20 07:04 dannyvankooten

I like this idea, too! Maybe we could have an option to choose a default time period in the settings and use it for both the main chart view and this new column in the post/page list?

danielrunvegan avatar Apr 05 '20 08:04 danielrunvegan

For me personally I don't need time period setting, total hits since ever is enough, just to keep things silly simple. Thanks!

svatoupravdu avatar Apr 06 '20 09:04 svatoupravdu

I support this. Even if possible, @dannyvankooten could implement a shortcode to show the views on the frontend per post.

kamauwanjoroge avatar Jul 18 '20 08:07 kamauwanjoroge

I've been collecting stats for last 6 months and I still miss the column with total hits count most. The column could still be optional though, there's an option pane above posts list in admin which could bear such checkbox.

svatoupravdu avatar Nov 26 '20 14:11 svatoupravdu

Never mind, I achieved my goal by installing WP Code Snippets plugin and enabling this snippet for admin area only:

add_filter('manage_post_posts_columns', function($columns) {
	return array_merge($columns, ['pageviews' => __('Pageviews', 'textdomain')]);
});
 
add_action('manage_post_posts_custom_column', function($column_key, $post_id) {
	global $wpdb;
	if ($column_key == 'pageviews') {
		echo $wpdb->get_var(
            $wpdb->prepare( "SELECT SUM(pageviews) FROM wp_koko_analytics_post_stats WHERE id = $post_id" )
        );
	}
}, 10, 2);

svatoupravdu avatar Mar 11 '21 21:03 svatoupravdu

https://wordpress.org/support/topic/counter-behind-the-postings/#post-14611944

larsschafer avatar Jun 30 '21 14:06 larsschafer