In some cases you might want to forward events that pagent tracks to your own tooling. For this purpose, you can setup an event listener on theDocumentation Index
Fetch the complete documentation index at: https://www.pagent.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
pagent:event bus on the window object and receive all events that pagent is tracking or creating.
Here is an example:
Note: If no session is active, pagent will not emit any events on the pagent:event bus.
Event types
Below is an overview of all event kinds that pagent emits.Event kind | Description |
|---|---|
| click | Fired whenever the visitor clicks anywhere on the page. |
| page_view | Fired each time a page is loaded or navigated to. |
| opt_in | Fired when the visitor explicitly opts-in to tracking. |
| opt_out | Fired when the visitor opts-out of tracking. |
| conversion | Fired when a conversion goal is recorded. |
| session_start | Fired the moment a new session begins. |
| session_end | Fired when the current session is terminated. |
| error | Fired whenever an error occurs while running pagent. |
| highlight_text | Fired when pagent highlights text on the page. |
| element_view | Fired when a tracked element scrolls into the viewport. |
| hover | Fired when the visitor hovers over a tracked element. |
| session_ping | Sent periodically while a session is active to keep it alive. |
Common properties
The following attributes are included in every event:| Property | Type | Description |
|---|---|---|
| session_id | string | Unique identifier of the current session. |
| visit_id | string | Unique identifier of the current page view. |
| time | number | Unix timestamp in milliseconds when the event occurred. |
| is_unique | boolean (optional) | true if this is the first time this event type was emitted during the session. |
| is_opted_in | boolean | Indicates whether the visitor has opted-in to tracking. |
| session_duration | number | Session duration in milliseconds at the moment the event was emitted. |
| scroll_depth | number | Maximum vertical scroll position in pixels that the visitor has reached so far. |
| scroll_percentage | number | Percentage of the page that has been scrolled. |
| url | string | Absolute URL of the page where the event happened. |
Example integration
You can also forward individual pagent events to other analytics platforms. The following example shows how to send the conversion event to JENTIS using its push-based data layer:conversion event and immediately submits it to JENTIS.