• Resolved vicetias

    (@vicetias)


    Hi,

    I want to know if is there any way to change the total views for each post? I just realized the stats aren’t stored in the database, so where can I find that data?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter vicetias

    (@vicetias)

    Or better migrate the views from a meta key called ‘post_views_count’. Is it possible?

    Plugin Support fresatomica

    (@fresatomica)

    Hi there,

    this wouldn’t be possible but, what exactly are you trying to achieve?
    Please note that, if you changed your domain name and lost the previous stats, we could migrate those to the new domain, we would just need to know the addresses of both sites.

    Thread Starter vicetias

    (@vicetias)

    Nothing of that.

    This is the first time I install Jetpack and I wanted to migrate the post views count from another plugin that creates a table in the database. Plus, I use a function to collect those views in a meta key for each post.

    So, I need to transfer those views to Jetpack stats… but it seems imposible :/

    Plugin Contributor James Huff

    (@macmanx)

    Currently, Jetpack can only import stats from WordPress.com sites and other Jetpack sites.

    Thread Starter vicetias

    (@vicetias)

    Oh well, ok.

    And is it possible to sort popular posts by Jetpack stats in a code like this?

    <?php global $post; $recent = new WP_Query(array( 'posts_per_page' => 5, 'orderby' => '?', 'date_query' => array() )); while($recent->have_posts()) : $recent->the_post(); ?>

    • This reply was modified 4 years, 5 months ago by vicetias.
    • This reply was modified 4 years, 5 months ago by vicetias.
    Plugin Support fresatomica

    (@fresatomica)

    I’m afraid we can’t help with custom code here but, have a look at this page, it may be helpful when creating custom hooks:

    https://developer.jetpack.com/

    Thread Starter vicetias

    (@vicetias)

    I didn’t find anything helpful there, but at stackexchange I found these lines but don’t work.

    $popular = stats_get_csv( 'postviews', array( 'days' => 2, 'limit' => 10 ) );

    $top_posts = stats_get_csv( 'postviews', 'period=month&limit=30' );

    $post_view_posts = stats_get_csv( 'postviews', array( 'days' => 2, 'limit' => 10 ) );

    • This reply was modified 4 years, 5 months ago by vicetias.
    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    at stackexchange I found these lines but don’t work.

    You can learn more about the old Stats API and the parameters it accepts here:
    https://stats.wordpress.com/csv.php

    https://phoxis.org/2011/04/24/wordpress-com-stats-api/

    That said, I’d recommend switching to the WordPress.com REST API instead if you’re looking to get information about Stats:
    https://developer.wordpress.com/docs/api/1.1/get/sites/%24site/stats/

    You should be able to get more information through there.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Change/edit post views count’ is closed to new replies.