restrict incrementation of post vies count when refreshing the page
I use a post views counter to save post views -
function calculatePostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '1');
return;
}
$count++;
update_post_meta($postID, $count_key, $count);
return;
}
The issue is, everytime the post page is refreshed manually, the view increments by 1. I need to check this. How ?