Analytics events provide real-time information about user actions on a Wix site. These events can be used by any integration that injects JavaScript into a Wix site. These events can help you track user behavior, measure performance, or react to site activity in real-time.
To listen to these events in your code, call registerEventListener().
Analytics events are organized into the following categories:
The code below registers a listener that captures all analytics events triggered on your site. The callback function receives the event name and associated data for every event. While all events are captured, you need to add a case in the switch statement for each event type you want to handle.
Note: This example is for a Wix-hosted environment that doesn't require authentication with a client. When building apps, the authentication method depends on your development environment. See the Site API introduction for detailed setup instructions for your specific environment.