How to Activate Fake Share Counters on Version 5.0?

Article sections

    Fake share counters function is supported as of version 5.0. If you are using lower version you can use the developer hooks for this or update plugin to latest version. Fake/Internal share counters will change all share counters to internal tracked by click over share buttons and you will see those values instead of real shares. The benefits are that you can set your own counters per post and set global minimal fake counters.

    To activate fake counters go to Manage Plugin Functions menu.

    Scroll till you find Developer functions and inside that panel activate Fake/Internal Share counters.

    How to manage Fake/Internal counters

    To set global minimal fake counters that will run on all posts you need to use the new Developer Tools Menu that will be visible only if Fake counters option is active.

    On each post you can set also individual share counters that will run. To do this use on post plugin metabox.

    Generating Random Fake Counters

    Easy Social Share Buttons for WordPress has also filter that you can use to modify the generated share counters on screen before render. Using this filter you can generate your own values of share counters or apply a new logic of fake counters. To do this you need to call filter essb4_get_cached_counters.

    add_filter('essb4_get_cached_counters', 'essb_cache_counters_parse');

    Here is one example usage of that filter which will multiply your real shares by 10 (for example if page has 12 shares you will see 120).

    if (!function_exists('essb_cache_counters_parse')) {
    	function essb_cache_counters_parse($cached_counters = array()) {
    		global $post;
    		
    		if (!isset($post)) return $cached_counters;
    		
    		$fake_factor = 10; // set your own multiplier value here
    		$post_id = $post->ID;
    		
    		$cumulative_total = 0;
    		foreach ($cached_counters as $network => $shares) {
    			
    			if ($network == 'total') continue;
    			
    			$shares = isset($cached_counters[$network]) ? $cached_counters[$network] : 0;
    			$shares = intval($shares) * $fake_factor;
    			
    			$cached_counters[$network] = $shares;
    			$cumulative_total += intval($shares);
    		}
    		
    		$cached_counters['total'] = $cumulative_total;
    	
    		return $cached_counters;
    	}
    	
    	add_filter('essb4_get_cached_counters', 'essb_cache_counters_parse');
    }
    Was this article helpful?
    YesNo
    in Share CountersSocial Share Buttons
    Was this article helpful?
    YesNo