Page History
Table of Contents | ||
---|---|---|
|
CardioLog SaaS Client-Side API
The CardioLog SaaS Tracking Agent offers a client-side API to send custom events, such as button clicks, banner clicks, navigation links or interactions with other UI components that display content dynamically (without redirecting to the actual content page URL).
...
You can call the sendEvent JavaScript function on any monitored page to send events to CardioLog SaaS via the client browser.
Info | ||
---|---|---|
| ||
/**
* @method sendEvent
* @param {JSON object} data
* @param {Function} [optional] function to be executed after the event is sent
*/
CardioLogAgent.API.sendEvent(data, eventCallback); |
The sendEvent function accepts the following parameters:
- data - Required. The event data in JSON format.
- eventCallback - Optional. Function to be executed after the event is sent.
Code Sample
...
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:
Info |
---|
<input type="button" value="DOWNLOAD" onclick="openDownloadForm(); CardioLogAgent.API.sendEvent({e: 'Button Click', metaData: {name: 'DOWNLOAD NOW'}}, function () {console.log('event sent successfully');});" /> |
When clicking on the button, a custom event of type ''Button Click" 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.
...
With the CardioLog SaaS API you can:
- Track visitor actions within the browser such as button and banner clicks, form field data entries and more by implementing some simple JavaScript using the client-side API.
- Send custom events to CardioLog from any application using the server-side API.
- Track visitor actions from non-browser applications, including mobile apps, using the server-side API.