How to transfer data from js in action yii2?

Good day!
The task: implement some similarity metrics\Analytics of website visitors.

How it is done now:
REST api
When entering the index runs actionCreate create a new object of type Visitor, if you create a fill in its properties ip, user agent, etc., then send it all to the database.

How I want to do:
when loading the page is loaded, some js file retrieves client data (ip, user agent, etc.) and sends them to the actionCreate (the name of the action in phantom), which in turn sends the data to the database.

The question:
how to implement the correct transfer of the necessary data, and in General working if the circuit will be (assuming that the client has js enabled of course)? Or necessary to continue to develop this all in php?
March 23rd 20 at 19:27
1 answer
March 23rd 20 at 19:29
AJAX

Find more questions by tags YiiAJAX