I included the link to the thread, but for convenience this is the function I used in functions.php:
/* Storing views of different time periods as meta keys */
add_action( 'wpp_post_update_views', 'custom_wpp_update_postviews' );
function custom_wpp_update_postviews($postid) {
// Accuracy:
// 10 = 1 in 10 visits will update view count. (Recommended for high traffic sites.)
// 30 = 30% of visits. (Medium traffic websites)
// 100 = Every visit. Creates many db write operations every request.
$accuracy = 50;
if ( function_exists('wpp_get_views') && (mt_rand(0,100) < $accuracy) ) {
// Remove or comment out lines that you won't be using!!
update_post_meta( $postid, 'views_total', wpp_get_views( $postid, 'all', false ) );
update_post_meta( $postid, 'views_daily', wpp_get_views( $postid, 'daily', false ) );
update_post_meta( $postid, 'views_weekly', wpp_get_views( $postid, 'weekly', false ) );
update_post_meta( $postid, 'views_monthly', wpp_get_views( $postid, 'monthly', false ) );
}
}
Then in WPBakery I used the meta-key of my choice (views_xxx) as custom sorting.
Just remember as the function’s author (@radgh) mentioned to set $accuracy to 100 for the first clicks.