Track Unique Views
-
Hi Slimstat Team
Great plugin, really is the only plugin that has all the features a website admin would require.
The plugin Mycred is an point based system for wordpress, im currently working with Gabriel the plugin author to integrate slimstat with mycred.
The ideology is to use slimstat to trigger mycred points to be awarded. In this case we are trying to award our users with points for unique views from slimstat.
We would like for example the following:
Author 1 has 500 posts, User A views all 500 posts, then Author 1 must only be awarded 1 point. Each unique page view must across all authors posts is considered a valid point.Example 2:
If Author 1 has 500 posts, User A and user B click all 500 of Author 1 posts. Then Author 1 will be awarded 2 Points.We want to track global unique views per author.
Thus far we have developed a way for users to get awarded points for pageviews, however this is not what we require, we need unique views instead of pageviews.
Please see code below and advise how may we integrate Mycred with Slimstat.
/** * Give Points for Content View * @since 1.0 * @version 1.0 */ add_action( 'slimstat_track_pageview', 'mycredpro_slimstat_pageview' ); function mycredpro_slimstat_pageview( $stats ) { if ( function_exists( 'mycred' ) ) { $post_id = absint( $stats['content_id'] ); $post = get_post( $post_id ); $mycred = mycred(); $points = 10; $log_entry = 'Points for page view'; // if the author is not excluded, give points is not excluded if ( ! $mycred->exclude_user( $post->post_author ) ) $mycred->add_creds( 'slimtrack_pageview', $post->post_author $points, $log_entry ); } }
Kind regards
- The topic ‘Track Unique Views’ is closed to new replies.