I am going to track number of plays of a video in my site by both visitors and users. Whenever the video starts playing I am using JavaScript for the event handling in the frontend and write to wp_options
or wp_usermeta
to track these interactions.
I was going to make an AJAX request to the wp_ajax_$action
and wp_ajax_nonpriv_$action
hooks but I'd like to use this small task as an opportunity to experiment with the new REST API since I heard it is going to replace the old wp-admin/admin-ajax.php
way of doing it on the long run.
How should I approach this?