The current version of the Promoboxx Javascript API is:

0.6.5

Please use the latest API version on new projects to ensure all known bugs are fixed and all documented features are available. See the Initialization chapter for API link code syntax.

(Note: Live projects should be thoroughly tested when upgrading.)

Events

Various events are raised during the loading and execution of the Promoboxx JSAPI. In order to attach handlers to these events, push the 'addListener' command to the _pbxx object. Parameters for the 'addListener' command include: the event name (a string), the handler (a function), and a high priortiy flag (a boolean). The high priority flag causes the included handler to get pushed to the top of the handler stack for that event. A high priority handler can be superceeded by a high priority handler pushed later in the script.

Most handlers should be pushed before pushing the 'load' command to ensure they will be attached before the relevant event is raised. Push the 'debugListeners' command to turn on console notifications of raised events.

In functions attached to event handlers, the keyword this will always refer to the _pbxx object itself. The variable _pbxx will also be available to event handlers and will point to the same object. When handling initialization events, be aware that some properties of the _pbxx object may not yet have been assigned.

Usage

_pbxx.push(['addListener', eventName, function(eventDataObject){
    /* function code */
  }, highPriority = true||false  // (optional)
]);

Available Events

Library Loading & Initialization Events

Event Description
initComplete

Fired after the script has loaded itself and registered any commands that have been pushed into the pre-load buffer.

initComplete

Fired after the script has registered its own tasks to be executed when data loads.

loadData

Fired when the campaign data load has been instigated (usually due to the "load" command being encountered in the buffered command stack).

loadResponseReceived

The requested raw campaign data response has been recieved from the server

loadDataComplete

The campaign data response has been loaded into memory and is a available via _pbxx properties. The JSAPI will begin processing tasks, loading libraries as necessary, and injecting content into token-classed elements.

parseComplete

Campaign data campaign data has been injected and state classes applied to document elements. The JSAPI has finished loading.

User Action-Related Events

Event Description
trackEvent

Fired when a track command has been initiated. Returning false from the handler will cancel the track command.

loadedRetailers

Fired when a set of retailers has been loaded in response to the user entering geographic search data or panning or zooming the Google lookup map.

saveLeadSubmit

Fired when the saveLead command is successful.

saveLeadSuccess

Fired when the saveLead command is successful.

saveLeadValidateErrors

Fired when the saveLead command has failed due to validation errors.