Events: what visitors do on the site, and the live feed
Describes Web Analytics 0.10.0. On an older release? The version menu above has this guide as it was then.
Events shows what visitors do once they are on a page: the buttons they click and forms they send, events your site reports itself, such as an order placed, and a feed of every hit as it arrives.
Where to find it
Web Analytics → Events (/admin/web-analytics/events). You need the Owner role or the Web Analytics permission. The page starts with the shared filter bar (period, site, Own traffic, Bots).
Events: clicks, form submits and custom events.
What visitors do
Buttons clicked and forms sent on LiveView pages, by the name the page gives them, up to 25. With the client script on, outbound links, downloads and contact links show here too, as Outbound link, Download and Contact link. Visitors is daily unique visitors who did it, added across the period; Times is how often it was done.
What is recorded is set in Settings under What visitors do: Record LiveView interactions, Events not to record and Event values to keep. Form typing and form contents are never recorded.
Custom events
Events the site reports itself, with a name of its choosing, up to 25. A developer sends them from the app or from the browser (see below). Same columns as above. Until there are any, the card says No custom events recorded in this period.
API requests
When paths are listed under API requests in Settings, or requests were recorded in the period, two cards appear:
- A card titled with the number of API requests and visitors, listing each Request by method and path, without the query string, with Times.
- API responses: the same requests by the class of their status: 2xx answered, 3xx redirected, 4xx refused or not found. 5xx errors are not recorded.
Until there are any, the cards say No API requests recorded in this period. API requests are not page views and belong to no visit, so no other report counts them. They are kept as long as raw events and never rolled up.
Live feed
Every hit as it arrives, newest first, updated every 10 seconds. The menu on the card picks All hits, Page views, Interactions, Exits, Custom events or API requests. Columns:
- Time: when it arrived.
- What: the hit in words, for example Viewed page or how long a visitor stayed before leaving.
- Page, and Source for page views.
- Client: browser and system.
- Visit: the end of the visit’s ID. Click it to open the whole visit.
The feed lists the 50 newest hits.
What it doesn’t do
- API requests are only recorded where the tracking plug runs, so it has to be in the API routes’ pipeline too.
- Pages without a LiveView report no clicks unless the client script is on (Accept the client script in Settings).
- An interaction keeps only its name and the short values of the parameters listed in Event values to keep.
For developers
Send a custom event from server code with PhoenixKitWebAnalytics.track_event("order.placed", %{conn: conn, path: "/checkout"}), or from the browser with the client script on: phoenixKitAnalytics('signup', {plan: 'pro'}). Any element can be named for click tracking with data-analytics="name".