Class: Zuko

Zuko

Members

(static) COMPLETION :Object

Standardised completion event to be used in sending a form completion event

Type:
  • Object
Deprecated:
  • This is a legacy version of Zuko.COMPLETION_EVENT to maintain backwards compatibility. See Zuko's COMPLETION_EVENT property

(static) COMPLETION_EVENT :Object

Standardised completion event to be used in sending a form completion event

Type:
  • Object

(static) FORM_VIEW_EVENT :Object

Standardised view event to be used when form is viewed.

Type:
  • Object

Methods

(static) deleteVisitorId()

Delete the current visitor's ID from the current Zuko object and remove the cookie

(static) getVisitorId() → {string}

Get the current visitor ID from the current Zuko object, or load from a cookie

Returns:

ID of the current visitor

Type
string

(static) setVisitorId(visitorId) → {string}

Set the visitor ID on the current Zuko object and store it in a cookie

Parameters:
Name Type Description
visitorId string

The ID of the current visitor

Returns:

ID of the current visitor

Type
string

(static) trackForm(params) → {Zuko}

Starts tracking a form on the page. Instantiates a tracking client. One tracking client should be used per form.

Parameters:
Name Type Description
params Object

A parameters object containing slug and target

Properties
Name Type Attributes Description
slug string

The "slug" identifier assigned to the form. This is provided by your account manager

target HTMLElement <optional>

The HTML element which contains your form, within which interactions will be tracked

Returns:

A new Zuko instance

Type
Zuko
Example
var client = Zuko.trackForm({
  target: document.getElementById('MyForm'),
  slug: 'my-form'
});

setAttribute(attribute, value) → {Zuko}

Sets a custom attribute for the current session

Parameters:
Name Type Description
attribute string

The name of the custom attribute

value string

The value for the custom attribute

Returns:

the Zuko tracking instance

Type
Zuko
Example
client
 .setAttribute('source', 'Google')
 .setAttribute('split_test', '1A')

trackEvent(event) → {Zuko}

Tracks a custom event for the current session

Parameters:
Name Type Description
event Event | Object

The event to be tracked

Properties
Name Type Description
type string

A short description of the custom event type

Returns:

the Zuko tracking instance

Type
Zuko
Examples
client.trackEvent(Zuko.FORM_VIEW_EVENT);
client.trackEvent({type: 'Address_Postcode: unable to locate address'});
client.trackEvent(Zuko.COMPLETION_EVENT);

unsetAttribute(attribute) → {Zuko}

Unsets a custom attribute for the current session

Parameters:
Name Type Description
attribute string

The attribute's category name to be unset

Returns:

the Zuko tracking instance

Type
Zuko
Example
client.unsetAttribute('source');