Support » Fixing WordPress » [Hack] How to use Stats Helper beside Jetpack.

  • Here is a small hack to use WordPress Stats Helper beside Jetpack. Everyone knows that: once Jetpack is installed, WordPress Stats will automatically be disabled. The WordPress Stats Helper check the existence of some functions of the WordPress Stats plugin to determine whether it is turning on or off. So if the Stats is disabled, the Stats Helper can not function too. But there’s a small hack to bypass the checking procedure. I will show you how now:

    • Open the file wpcomstats-helper.php under wp-content/plugins/wordpresscom-stats-helper/
    • Go to the code block: function wpcomstats_api_key()
    • Comment out some lines and manually add your api-key like this:
      // Check if worpress.com stats plugin is installed
      //	if (!function_exists('stats_get_api_key') || //!function_exists('stats_get_option')) {
      //		echo 'WordPress.com stats not installed!';
      //		return null;
      //	}
      	// Check if the API key is defined
      //	$api_key = stats_get_api_key();
      $api_key = "your_own_api_key";
      	if (empty($api_key)) {
      		echo 'API Key not defined!';
      		return null;
      	}
      	return $api_key;

    (double-check again to make sure you have done correctly, because if there’s something wrong, it will break some parts of your site)
    Assumed that you’ve known how to get api key. Now the api key for wordpress and akismet are the same thanks to automattic. ;))
    Because the fetching data function of Stats Helper is independent from Stats, so you don’t have to worried where the data will come from.
    Aah, and don’t forget to enable your Stats Helper plugin after doing everything I’ve shown you. Good luck!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Hack] How to use Stats Helper beside Jetpack.’ is closed to new replies.