{"id":3627,"date":"2011-03-20T12:40:52","date_gmt":"2011-03-20T19:40:52","guid":{"rendered":"http:\/\/www.krunk4ever.com\/blog\/?p=3627"},"modified":"2011-03-20T12:40:52","modified_gmt":"2011-03-20T19:40:52","slug":"getting-wordpress-com-stats-helper-to-work-with-jetpack","status":"publish","type":"post","link":"https:\/\/www.krunk4ever.com\/blog\/2011\/03\/20\/getting-wordpress-com-stats-helper-to-work-with-jetpack\/","title":{"rendered":"Getting WordPress.com Stats Helper to work with JetPack"},"content":{"rendered":"<p>WordPress recently released their <a href=\"http:\/\/jetpack.me\/\">JetPack plugin<\/a> which replaced <a href=\"https:\/\/wordpress.org\/extend\/plugins\/stats\/\">WordPress.com Stats plugin<\/a>. After upgrading, things took a bit to update, but most things worked fine afterwards. However, my Popular Posts widget (Most Viewed Posts) remained broken with the error: <em>WordPress.com stats not installed<\/em><\/p>\n<p>I was too busy this week to look into the cause of the issue and a quick search online didn&#8217;t result in much traction. This weekend, I finally got some time and found this post on WordPress forums: <a href=\"https:\/\/wordpress.org\/support\/topic\/hack-how-to-use-stats-helper-beside-jetpack\">[Hack] How to use Stats Helper beside Jetpack.<\/a><\/p>\n<p>Thanks to herophuong&#8217;s help, I realized what was causing the issue. The Most Viewed Posts widget is part of the <a href=\"https:\/\/wordpress.org\/extend\/plugins\/wordpresscom-stats-helper\/\">WordPress.com Stats Helper plugin<\/a> and it was looking up a function that no longer exists. When you installed JetPack, it automatically deactivated WordPress.com Stats. The helper plugin needed the API key in order to query for data.<\/p>\n<p>You can either do what herophuong suggested in his post, but I thought a more elegant solution would be to create a separate plugin that created the function that it was looking for. That way when there are updates to the plugin, it won&#8217;t trample over your changes.<\/p>\n<p><a href=\"http:\/\/www.krunk4ever.org\/stats-api-key.zip\"><strong>Stats API Key<\/strong><\/a><\/p>\n<p>All this plugin does is add the missing function <em>stats_get_api_key<\/em> and return the API key. After you download this plugin, you have to add your API key to the plugin.<\/p>\n<p>You probably have an API key already. There are a couple ways to retrieve it.<\/p>\n<ul>\n<li><a href=\"https:\/\/apikey.wordpress.com\/\">apikey.wordpress.com<\/a><\/li>\n<li>Akistmet settings &#8211; Go into your WordPress Plugins page and click on <em>settings<\/em> underneath Akismet<\/li>\n<\/ul>\n<p>You can always go to <a href=\"https:\/\/apikey.wordpress.com\">apikey.wordpress.com<\/a> to sign up for one if you don&#8217;t have one already.<\/p>\n<p>After you download the plugin and obtain your API key, open the included stats-api-key.php and replace ENTER_API_KEY_HERE with your API key. Remember to leave the quotes.<\/p>\n<p>Upload this file to your WordPress plugins directory (usually wp-content\/plugins\/) and go back to your WordPress Plugins Page, refresh the page if needed, locate the newly added Stats API Key plugin, and activate it.<\/p>\n<p>Your Most Viewed Posts and any other thing that relies on WordPress.com Stats Helper should work now.<\/p>\n<p>A couple things I noticed was it took a couple minutes for it to successfully retrieve the stats. Before it completed that, my most viewed posts widget would show my latest 5 posts. But be patient and it&#8217;ll eventually work.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress recently released their JetPack plugin which replaced WordPress.com Stats plugin. After upgrading, things took a bit to update, but most things worked fine afterwards. However, my Popular Posts widget (Most Viewed Posts) remained broken with the error: WordPress.com stats not installed I was too busy this week to look into the cause of the &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.krunk4ever.com\/blog\/2011\/03\/20\/getting-wordpress-com-stats-helper-to-work-with-jetpack\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Getting WordPress.com Stats Helper to work with JetPack&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[12,11],"tags":[1358,20,1356,1357],"_links":{"self":[{"href":"https:\/\/www.krunk4ever.com\/blog\/wp-json\/wp\/v2\/posts\/3627"}],"collection":[{"href":"https:\/\/www.krunk4ever.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.krunk4ever.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.krunk4ever.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.krunk4ever.com\/blog\/wp-json\/wp\/v2\/comments?post=3627"}],"version-history":[{"count":0,"href":"https:\/\/www.krunk4ever.com\/blog\/wp-json\/wp\/v2\/posts\/3627\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.krunk4ever.com\/blog\/wp-json\/wp\/v2\/media?parent=3627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.krunk4ever.com\/blog\/wp-json\/wp\/v2\/categories?post=3627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.krunk4ever.com\/blog\/wp-json\/wp\/v2\/tags?post=3627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}