CardioLog SaaS Client-Side API
The CardioLog SaaS Tracking Agent offers a client-side API to send events, and track button clicks, banner clicks, navigation links or interactions with other UI components that display content dynamically (without redirecting to the actual content page URL).
The sendEvent JavaScript Function
You can call the sendEvent JavaScript function on any monitored page to send events to CardioLog SaaS via the client browser.
The sendEvent function accepts the following parameters:
- eventName - Required. The event type name (e.g, 'Pageview').
- URL - Required. The content page URL.
- eventCallback - Optional. Function to be executed after the event is sent.
Code Sample
In this example, when a user clicks on the DOWNLOAD button on the home page, a popup window is opened with the download form:
Download Button
Download Form
In order to send a click event on the DOWNLOAD button, add a call to the sendEvent function to the button onclick event as seen below:
When clicking on the button, an event of type ''pageview" will be sent, indicating that the download button has been clicked on by the user. An "event sent" message will appear in the browser console.
In order to confirm that the event was sent successfully, open the browser Network tab and confirm that the request to the CardioLog Analytics SaaS events service returned the 200 status code as seen below: