Title: WP REST API suuport
Last modified: December 26, 2016

---

# WP REST API suuport

 *  Resolved [Hatem Hosny](https://wordpress.org/support/users/hatemhosny/)
 * (@hatemhosny)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/wp-rest-api-suuport/)
 * Is there a way to track statistics for the requests (to custom post types) by
   WP REST API?

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Contributor [Greg Ross](https://wordpress.org/support/users/gregross/)
 * (@gregross)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/wp-rest-api-suuport/#post-8591724)
 * My guess would be no as the REST api doesn’t run the page load logic required
   to run the WP Statistics code.
 * You wouldn’t want to count these as visits as they would likely be part of another
   page request by a user.
 * It will be something to investigate for a future version.
 *  Thread Starter [Hatem Hosny](https://wordpress.org/support/users/hatemhosny/)
 * (@hatemhosny)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/wp-rest-api-suuport/#post-8591753)
 * thanks for the quick reply
 * I am planning to use REST API to serve web and mobile apps, so a GET request 
   to the end point of custom post item will be equivalent to post view
 * I was thinking about calling a function that runs your code in this hook:
    [rest_post_dispatch](https://developer.wordpress.org/reference/hooks/rest_post_dispatch/)
 * Is that possible?
    Thanks
    -  This reply was modified 9 years, 6 months ago by [Hatem Hosny](https://wordpress.org/support/users/hatemhosny/).
    -  This reply was modified 9 years, 6 months ago by [Hatem Hosny](https://wordpress.org/support/users/hatemhosny/).
 *  Thread Starter [Hatem Hosny](https://wordpress.org/support/users/hatemhosny/)
 * (@hatemhosny)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/wp-rest-api-suuport/#post-8591769)
 * something like that
    [https://www.dfactory.eu/support/topic/logging-a-view-using-the-wp-rest-api/#post-10470](https://www.dfactory.eu/support/topic/logging-a-view-using-the-wp-rest-api/#post-10470)
 *  Plugin Contributor [Greg Ross](https://wordpress.org/support/users/gregross/)
 * (@gregross)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/wp-rest-api-suuport/#post-8591781)
 * It’s possible but the code has some built in assumptions that may not be true
   during a rest request, you’d have to try it and see if it works.
 *  Thread Starter [Hatem Hosny](https://wordpress.org/support/users/hatemhosny/)
 * (@hatemhosny)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/wp-rest-api-suuport/#post-8591799)
 * so which function should I call?
 *  Plugin Contributor [Greg Ross](https://wordpress.org/support/users/gregross/)
 * (@gregross)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/wp-rest-api-suuport/#post-8596635)
 * That’s more complex, you can take a look at the code in `wp_statistics_shutdown_action()`(
   line 250 of the main wp-statistics.php) to see how we normally call the data 
   collection functions, but there is no one single magic function you would call.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘WP REST API suuport’ is closed to new replies.

 * ![](https://ps.w.org/wp-statistics/assets/icon.svg?rev=3081064)
 * [WP Statistics – Simple, privacy-friendly Google Analytics alternative](https://wordpress.org/plugins/wp-statistics/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-statistics/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-statistics/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-statistics/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-statistics/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-statistics/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Greg Ross](https://wordpress.org/support/users/gregross/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/wp-rest-api-suuport/#post-8596635)
 * Status: resolved