Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The CardioLog SaaS Tracking Agent offers a client-side API to send custom events, and track 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). 

...

Info
iconfalse
/**
* @method sendEvent
* @param {String} eventName
* @param {StringJSON object} URLdata
* @param {Function} [optional] function to be executed after the event is sent
*/
CardioLogAgent.API.sendEvent(eventNamedata, URL, eventCallback);

The sendEvent function accepts the following parameters:

  • eventName data - Required. The event type name (e.g, 'Pageview').
  • URL - Required. The content page URL.
  • data in JSON format.
  • eventCallback - Optional. Function to be executed after the event is sent.

...

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
iconfalse
<input type="button" value="DOWNLOAD" onclick="openDownloadForm();CardioLogAgent.API.sendEvent(
'Pageview
{e: 'Button Click',
'http://www.intlock.com/pages/download.aspx', function ()
 metaData: {name: 'DOWNLOAD NOW'}}, function () {console.log('event sent successfully');}); />

When clicking on the button, an a custom event of type ''PageviewButton 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.

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:

...