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 events, and track button clicks, banner clicks, navigation menu links or interactions with other UI components that display content dynamically (without redirecting to the content 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. 

Info
iconfalse

CardioLogAgent.API.sendEvent(eventName, URL);

The SendEventsendEvent function accepts the following parameters:

Code Sample

 

Send a click event on a DOWNLOAD button:

 

Info
iconfalse

<input type="button" value="DOWNLOAD" onclick="openDownloadForm();CardioLogAgent.API.sendEvent('pageview', 'http://www.intlock.com/pages/download.aspx');" />

 

...

 

Info
iconfalse

__eEvents = {
Visit: { id: 0, name: "Visit" },
Leave: { id: 1, name: "Leave" },
Search: { id: 2, name: "Search" },
SearchResultItem: { id: 4, name: "SearchResultItem" },
SearchResultClick: { id: 5, name: "SearchResultClick" },
External: { id: 10, name: "External" },
Goal: { id: 20, name: "Goal" },
"Goal-Test": { id: 21, name: "Goal-Test" },
Test: { id: 22, name: "Test" },
Score: { id: 23, name: "Score" },
Ping: { id: 24, name: "Ping" },
Item-Sold: { id: 100, name: "Item-Sold" },
Unknown: { id: -1, name: "Unknown" }
};

 

3. Implement the call to the SendEvent function when an item is sold (using our Client-Side API or Server-Side API).

4. Create a custom report to display the number of items sold using the CardioLog SDK.

...

In order to track visitor actions for non-browser apps, developers must send usage event objects to the CardioLogAgent web application through HTTP POST requests in JSON format. The JSON string must be embedded in the request body. The POST response is provided in JSON format as well.

  • The request must include a "Content-Type: application/json" header
  • The request may optionally include an "Accept: application/json" header

The Event Object

CardioLog Analytics usage event objects have the following properties:

...

  • Search event - The search term
  • View event:
    • If __Referrer parameter was passed to this page, __Referrervalue 
    • If there is a Referrer cookie, sends the ReferrerReason cookie value 
    • If this is the first page the user views in this session, sends "First In Session" and appends the data from __Referreragent
  • Duration event - Time on page in seconds

...

  • In Search event - Number of total results
  • In Visit event - If there is a Referrer cookie, sends its content
  • In Duration event - Last visit event ID

...

In addition to event objects, the request body may include the following properties:

  • browserType - The user-agent information
  • sessionid - Any string format accepted.
  • un - User name. Any string format accepted.

The JSON Request Format

The full JSON request format is as follows:

{
    "events": {
      "event": [
        {
          "u": "http://www.intlock.com/",
          "X": "|referral|blog.intlock.com|/about/||",
          "et": 0,
          "RI": 564940
        },
        {
          "X": "1",
          "Y": "7",
          "et": 23,
          "RI": 0
        }
      ]
    },
    "browserType": "Apple-iPhone5C2/1001.525",
    "sessionid": "861529144.325047542",
    "un": "INTLOCK\\tomj"
}

The API URL

The default API URL for a SharePoint site is:

https://[SharePoint WFE]/_layouts/CardioLogAgent/tunnel.aspx?random=895.3324414324015

  • Replace [SharePoint WFE] with your SharePoint URL address
  • The random param is used as a cache buster

Image Removed
www.intlock.com Main Page "Download" Button
In this example, when a user clicks on the DOWNLOAD button the DOWNLOAD button a popup window is opened with the download form, and an event of type ''pageview" is sent, specifying indicating that the download button has been clicked on by the user.
Image Removed
Image Added
 Download Button
 
Image Added

...

By using the CardioLog Server-Side API, /CardioLogAPI/Events.asmx web service, and the SendEvent method, you can send viewduration and search events, custom events, and track the URL of the referrer page.

...

The SendEvent method in the /CardioLogAPI/Events.asmx web service accepts the following parameters:

  • UserName - Optional. The user associated with the event. If not passed, the method will use the current user credentials.
  • SessionID - Required. The unique session ID associated with the event.
  • Event Type - Required. The event type ID number
  • URL - Required. The URL of the page where the event occurred.
  • UserAgent - Optional. The user details including browser type and OS version.
  • ClientIP - Optional. The user IP address.
  • Param1 - Optional. Used to store additional information about the event, typically for custom event types. This string is limited to 1000 characters. Built-in events reserve this string for the system. For example, in a "Visit" event it stores the referrer information; in a "Search" event it stores the search term.
  • Param2 - Optional. Used to store additional information about the event, typically for custom event types. This string is limited to 50 characters. Built-in events reserve this string for the system. For example, in a "Search" event it is used to store the number of results.

After the event is sent, the web service XML response will include the event identifier for future use, which you can later use to send events related to this event accordingly:

Info
iconfalse

<agent>
 <log>
 <status id='0'>OK</status>
 <event id='211022'/>
 </log>
 </agent>

 In case of an error, the XML response will include this error description:

Info
iconfalse

<agent>
<log>
 <status id='-1'>Invalid Path</status>
 </log>
 </agent>

...

The SendEvent method supports four event types. The ID number is used in the Server-Side API. The Event Type Title is used in the Client-Side API.

View - Individual page request, or element clicked

  • Event Type ID - 0
  • Event Type Title - "Visit"

To set the page referrer, use the following optional parameters to track the source of the page:

  • Param1 -The related view event ID or a string representing referrer types such as navigation toolbars, campaigns, banners, etc.
  • Param2 -The referrer page URL

Referrer pages can be retrieved in CardioLog with the "Navigation" visual controls.

Duration - Time spent on a page or element (in seconds).

  1. Event Type ID - 1
  2. Event Type Title - "Leave"
  3. URL - The related view event URL.
  4. Param1 - Duration in seconds.
  5. Param2 - The related view event ID.

Search - Onsite (internal) search

  • Event Type ID - 2
  • Event Type Title - "Search"
  • URL - The related view event URL.
  • Param1 - Search keyword/phrase.
  • Param2 - Number of search results.

Search events can be viewed in CardioLog in the Onsite Searches report, popular search terms are displayed in the Onsite Search Phrases report.

Search Result Click -

  • Event Type ID - 5
  • Event Type Title - "SearchResultClick"
  • URL - The search result URL.
  • Param1 - The search result position within search results.
  • Param2 - The related search event ID.

...

You can create custom event types and build custom reports using the CardioLog SDK. The custom event types can be used in the SendEvent function, for both Client-Side and Server-Side APIs. For example, if your website is a sales site and you wish to track each product sold, and then you can create a report on the number of items sold, and create a custom event type in CardioLog named "Items-Sold."

1. Add the custom event type to the CardioLog database by executing the following query against the CardioLog database:

Info
iconfalse

INSERT INTO tab_event_type(id,description)

VALUES(100, 'Items-Sold')

GO

  • ID - must be 100 or higher
  • Description - event type title

2. Add the custom event type to the CardioLog tracking agent events array - edit the __eEvents array and add the custom event type in:

...

Download Form