The center Object

This describes the commands available on the center() object.

Method Summary

The following commands are available to be called on the Center Command Queue. Commands not defined here will not perform any operations.

All commands return a boolean value indicating the internal success or failure of the operation.

Commands  
center('create', [propertyId], [propertyName], [options]) Create a new Property to be tracked. Will receive Events prefixed with the propertyName.
center('require', [plugin]) Require a new plugin into the tracking code. Plugin commands can now be executed with the [plugin]: prefix.
center('[propertyName.]associate', [email], [commandOptions]) Associate an email address to the current visitor for the property.
center('[propertyName.]send', [kind], [action], [label], [value] [commandOptions]) Send an event to center for the property.

Method Details



Create

Create a new Property ID to be tracked. Commands can be executed against this property to track events and data.

Usage

center('create', [propertyId], [propertyName], [options]);

Parameters

Name Type Required Description
command string yes ‘create’
propertyId string yes Unique identifier for your property. This is created in the Center UI and resembles xxxxxxxxxxxxxxxxxxxxxx
propertyName string no Unique friendly name for your property. This is used for command targeting.
options object no Optional flags for the property. See table below.

Options

Name Type Default Description
captureEmailForms boolean false Whether to listen for email addresses in form submissions and associate them to the visitor.
captureEmailURLs boolean true Whether to look for email addresses in URL and associate them to the visitor.
customId string ’’ Custom identifier to include with events.

Examples

This is included in the default Installation Snippet shown by the Center UI.

center('create', 'xxxxxxxxxxxxxxxxxxxxxx', 'SiteName', {
  captureEmailForms: true,
  captureEmailURLs: true,
  customId: 'MyCustomId-1234'
});



Require

Require a plugin to be included in the tracking code. Plugin Commands can now be executed.

Usage

center('require', [pluginName]);

Parameters

Name Type Required Description
command string yes ‘require’
pluginName string yes Name of a supported Plugin

Examples

center('require', 'youtube');



Associate

Associate an email address to the current visitor. This command can be targeted at a specific property or general to all created properties.

Usage

center('PropertyName.associate', [email], [options])

Parameters

Name Type Required Description
command string yes ‘associate’. May optionally be prefixed with a PropertyName to target the command to a specific property.
email string yes Email address to be associated.
options object no Optional flags for the property. See table below.

Options

Name Type Default Description
callback function null Callback function once the command is complete.

Examples

center('associate', 'user@domain.com');
center('PropertyName.associate', 'user@domain.com', {
  callback: function() {
    alert('user has been associated!');
  }
});



Send

Send a visitor event to Center. This command can be targeted at a specific property or general to all created properties.

Usage

center('PropertyName.send', [kind], [action], [label], [value], [options])

Parameters

Name Type Required Description
command string yes ‘send’
kind string yes The kind or category of the event. The only predefined kind is view to represent a page view. However any other string can be used to define a custom event.
action string no The action of the event.
label string no the custom label of the event.
value number no A monetary value to assign to the event
options object no Optional flags for the property. See table below.

Options

Name Type Default Description
callback function null Callback function once the command is complete.
customId string ’’ Custom identifier to include with this events

Examples

center('send', 'view');
center('PropertyName.send', 'click', 'banner', 'bottom-page', 0);
center('send', 'buy', null, null, 29.99);
center('PropertyName.send', 'view', null, null, null, {
  callback: function() {
    alert('view has been tracked!');
  },
  customId: 'EventCustomId1234'
});