Support » Plugin: Jetpack Post Views » API key

  • Resolved Topher

    (@topher1kenobe)


    I first installed this on my dev server and grabbed the views out of the meta info and printed them in my template and it worked GREAT.

    I moved it to live and I’m not seeing the views meta key in my post meta. That’s when I read the doc and saw that I need to tell THIS plugin my jetpack API key.

    Why did it work on my dev server without me telling it my API key in some way? I assumed it would use the one in Jetpack.

    I’m running this on a large network, do I need to create a widget on every site, give it the key for that site, and then deactivate the widget? I don’t want a widget, but is that the only way to tell this plugin what the API key is?

    Thanks for the advice!

    http://wordpress.org/extend/plugins/jetpack-post-views/

Viewing 15 replies - 1 through 15 (of 19 total)
  • Plugin Author Steven Lambert

    (@straker503)

    I’m not quite sure why it would have worked on your dev server without the API key since the Jetpack API needs that key to access the information. Very interesting.

    The current setup does require that the API key be entered in the widget per site. The way in which you describe how you want to use it tells me I should remove the API key from the widget and put a plugin settings page where you enter the key. This is probably how it should be anyway, plus it would let me implement the other settings I’m working on better. Thanks for the support request so I could think about it this way.

    Topher

    (@topher1kenobe)

    That would be really fantastic. Do you have a timeframe in mind for that?

    Until then, I can make a widget, put the key in, and then move the widget to the inactive area?

    Topher

    (@topher1kenobe)

    I see there’s an option in the options table for jetpack_post_views_wp_api_key Can I simply put it in there?

    Plugin Author Steven Lambert

    (@straker503)

    Moving the widget to the inactive area will work just fine after the API Key has been entered. If you feel confident with the PHP code you could just hard code the API key to the options table, though the function to grab all the post view information is only ran either every hour or when you click the save button on the widget.

    Plugin Author Steven Lambert

    (@straker503)

    I would love to get the new version released this weekend, but it depends if I’m able to put in as much time as I would like to.

    Topher

    (@topher1kenobe)

    I’m happy to test or help if needs be. I really need it. 🙂 Your chosen mechanism for making the data available is wonderful. 🙂

    Topher

    (@topher1kenobe)

    I’m trying to think of a way to make this work without having to put our API key in. Doesn’t Jetpack already store the API key in the options table? Is there any way to reference that?

    Plugin Author Steven Lambert

    (@straker503)

    I tried that at first, but as far as I can tell, WordPress does not store it’s own API Key in the database at all. I searched for it using PhPMyAdmin, and nothing came up. So I was forced to find it a different way and the api.wordpress.com site is the only way I found. 🙁 I wish it stored it in the database so I could reference it.

    Topher

    (@topher1kenobe)

    It looks like stats_get_csv() will get the data you need. Something like this:

    if (function_exists(‘stats_get_csv’)) {
    global $post_stats;
    $post_stats = stats_get_csv(‘postviews’, ‘&days=-1&limit=-1&summarize’);
    }

    It simply asks jetpack for it, rather than hitting the server again.

    Plugin Author Steven Lambert

    (@straker503)

    I tried that function in my dev environment, and it didn’t exist. I never did try it in my production environment though, so I’ll give it a try. But I think that function not existing might be the reason http://wordpress.org/extend/plugins/wordpresscom-popular-posts/ stop being actively developed. I’ll let you know what I find later today.

    Topher

    (@topher1kenobe)

    That would make sense, I found yours because posts-n-pages quit working for us.

    That said, the function exists in jetpack. I haven’t done any research to see if it’s still working. I can do a post in their support area to see if it’ll still work.

    Plugin Author Steven Lambert

    (@straker503)

    So it seems that the function exists on my production environment, so I can use it as the primary source for the information (it’s more up to date anyway for the stats). I’ll still have options for entering API information if for some reason the function doesn’t exist.

    Topher

    (@topher1kenobe)

    Yep. That function comes from Jetpack, so as long as you have that on your dev machine it should be there.

    Are you still thinking of doing it this weekend? I like your method of making the data available more than the plugin I’ve been using.

    Plugin Author Steven Lambert

    (@straker503)

    Ya, the plan is still to get the new version out this weekend.

    Topher

    (@topher1kenobe)

    Awesome, I’ll be on all weekend, happy to test. Can you see my email address?

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘API key’ is closed to new replies.