This is a technical article aimed at users who wish to track "custom" javascript events within the browser

(For example tracking that a visitor hovered over an element or triggered something within the DOM)

By default CANDDi tracks all interactions between a web-browser and the server

Page views
Form submissions
Off-site links
Video views
Document downloads


However - on occasion - you may wish to track other "non-browser to server" events.  (For example the visitor triggers a pop-up, hovers over a text area or triggers a focus event on a button).

CANDDi's Javascript Tracker has a full open API which enables tracking of "any" event within your application

Trap the event within your own javascript

<a href="XXX" onclick="javascript:fnClick()">
> or
>   $("element").onClick(function(){})
> etc

Trigger a call to the CANDDi API (note we recommend wrapping this to ensure that the canddi object has loaded)

if(window.canddi) {
>  window.canddi.sendEvent(
>     strName,
>     objElement,
>     bNewGoal,
>     strGoalType,
>     strURL,
>     strTrackerGoalTitle
>  );
> }


   strName is the Title that you wish the event to have

   objElement is a javascript hash {key1:value1, key2:value2} of parameters

   bNewGoal (boolean value) set to false

   strGoalType This is used internally by CANDDi - default to "event"

   strURL This is the URL to display as the "page"

   strTrackerGoalTitle This is the title that you wish the Event to have when displayed within CANDDi


if(window.canddi) {
>   window.canddi.sendEvent(
>     "Register",
>     {Name:"Tim Langley","Email":""},
>     false,
>    "event",
>    "",
>    "Register for new Event"
> );
> }

Have more questions? Submit a request
Was this article helpful?
Thank you!