Title: Trigger hit rest endpoint from javascript
Last modified: December 11, 2020

---

# Trigger hit rest endpoint from javascript

 *  Resolved [garfield](https://wordpress.org/support/users/g4rf/)
 * (@g4rf)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/trigger-hit-rest-endpoint-from-javascript/)
 * Hi!
 * Great plugin we used for the last four years. Now we change our site to a WebApp
   with only one request (the initial), that get’s all data. So there will be only
   one site hit per visitor, even if they are viewing more content.
 * Is there a documentation for your REST API, so we can trigger a hit from javascript?
 * Best,
    Jan

Viewing 1 replies (of 1 total)

 *  Thread Starter [garfield](https://wordpress.org/support/users/g4rf/)
 * (@g4rf)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/trigger-hit-rest-endpoint-from-javascript/#post-13813802)
 * **Solution:**
    There is the REST API add on. As we are a non-profit organisation,
   there are at the moment no capabilities to use a payed plugin.
 * **Workaround:**
    Just call the specific url in an ajax request. It’s not optimal
   as the server does site generation and this only works without the “use plugin
   cache” option. But it’s the simplest workaround for now.
 * Example with _jQuery_:
 *     ```
       var url = "/path/to/page/to/record/a/hit";
       jQuery.ajax(window.location.origin + url);
       ```
   
    -  This reply was modified 5 years, 5 months ago by [garfield](https://wordpress.org/support/users/g4rf/).
    -  This reply was modified 5 years, 5 months ago by [garfield](https://wordpress.org/support/users/g4rf/).

Viewing 1 replies (of 1 total)

The topic ‘Trigger hit rest endpoint from javascript’ 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/)

 * 1 reply
 * 1 participant
 * Last reply from: [garfield](https://wordpress.org/support/users/g4rf/)
 * Last activity: [5 years, 5 months ago](https://wordpress.org/support/topic/trigger-hit-rest-endpoint-from-javascript/#post-13813802)
 * Status: resolved