How can we help?
< All Topics
Print

Tracking Javascript Events

This is a technical article for all you javascript lovers out there. If you’re looking to track ‘custom’ javascript events within the browser, today is your lucky day! WOEXA tracks all interactions between a web-browser and the server by default. This includes:

  • 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.

WOEXA’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(){})

Trigger a call to the WOEXA API (NOTE: we recommend wrapping this to ensure that the WOEXA object has loaded.)

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

  • ‘strName’ is the Title of the event
  • ‘objElement’ is a javascript hash {key1:value1, key2:value2} of parameters.
  • bNewGoal (boolean value) set to false
  • strGoalType is used internally by WOEXA – 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 WOEXA

Example:

if(window.canddi) {
    window.canddi.sendEvent(
        "Register",
        {Name:"Tim Langley","Email":"tim@canddi.com"},
        false,
        "event",
        "https://www.canddi.com",
        "Register for new Event"
    );
}

If you need a hand with this, let us know at help@woexa.com and we’ll see what we can do!

Table of Contents