Our documentation is changing, please click here to enjoy it!

Skip to end of metadata
Go to start of metadata

7.1 Core plugin

core:updateDeviceInfo

Use this command whenever you want to update the current user's information. Some fields, that we use internally, are filtered.

ArgumentRequiredTypeDescription
optionsyes<object>a list of fields <string> with value <string|number>
callbacksoptional<object>
  • "onSuccess" : <void> 
  • "onError" : <string> label error
For example

core:getDeviceID

Use this command to retrieve the current user device ID.

ArgumentRequiredTypeDescription

options

not used  
callbacksyes<object>
  • "onSuccess" : <string> device ID
  • "onError" : <string> label error while retrieving the user device ID


For example

core:isCompliantWithPushPlugin

Use this command to know if the user is compliant with the Push Plugin

ArgumentRequiredTypeDescription

options

not used  
callbacksyes<object>
  • "onSuccess" : <void>
  • "onError" : <void>


For example


core:addCustomListeners

Use this command to register your custom listeners to an event triggered by the library

ArgumentRequiredTypeDescription
optionsyes<object>

a list of event names <string> with listener <function>. Available Core plugin events :

  • "sdkLoaded" : <object> this event is retroactive, i.e. if you use this command after the library has been loaded, your provided listener will be triggered. It is also a one time event. It returned a object containing the set configuration of your application
callbacksoptional<object>
  • "onSuccess" : <array> returning the events that have been listened
  • "onError" : <string> label expliciting the reason why no events have been listened
For example

7.2 Push plugin

push:showAlert

Use this command when you want to show the HTML alert to the user.

ArgumentRequiredTypeDescription
optionsoptional<object>

a new set of parameters that can override the configuration of your application (see the "alert configuration" section to check all the possibilities)

callbacksoptional<object>
  • "onSuccess" : <void>
  • "onError" : <string> label error
Example

push:launchLandingOnClick

Use this command to bind one or more DOM Anchor Elements (</a> tag) to launch the optout-to-optin landing page on click.

ArgumentRequiredTypeDescription
optionsyes<array>of <string> containing selected anchors to bind. The value must start with "#" or "." (ID or ClassName)
callbacksoptional<object>
  • "onSuccess" : <array> provided elements that have been utterly binded
  • "onError" <string> label error
Example

push:requestBrowserPermission

Use this command to bind one or more DOM Anchor Elements (</a> tag) to display the native push browser's permission (from SDK 3.3.x)

ArgumentRequiredTypeDescription
optionsyes<array>of <string> containing selected anchors to bind. The value must start with "#" or "." (ID or ClassName)
callbacksoptional<object>
  • "onSuccess" : <array> provided elements that have been utterly binded
  • "onError" <string> label error
Example

If you want to display the browser native permission once the user clicks on a specific link of your website instead of immediatly once the page is loaded, you must set a generic css identifier (ID) to your anchor <a>: accengageRequestBrowserPermission

The SDK will then check this ID when the page is loading:

  • If there is no ID, browser native permission will be triggered immediatly once the page is loaded.
  • if there is an ID, browser native permission will not be triggered automatically but when the user will perform a click on the link you set up.
     
Example

 

push:isOptin

Use this command to know if the user is optin to push. It can tell why the user is optout, e.g. if he has denied the native notification permission.

ArgumentRequiredTypeDescription
optionsnot used  
callbacksoptional<object>
  • "onSuccess" : <object: status <string>, details <object>> user is optin
  • "onError" <object: status<string>, details <object>> user is optout
Example

push:addCustomListeners

Use this command to register your custom listeners to an event triggered by the library

ArgumentRequiredTypeDescription
optionsyes<object>

a list of event names <string> with listener <function>. Available Push plugin events :

  • "plugin:started" : <object> this event is retroactive, i.e. if you use this command after the library has been loaded, your provided listener will be triggered. It is also a one time event. It returned a object containing the set configuration of the plugin
     
  • "landingFeedback:optin" : <void> triggered when the optout-to-optin landing page returns that the user has granted permission and is now optin
  • "landingFeedback:softOptout" : <void> same thing, but triggered when the user has not granted the notification permission. In this case, the user can still be optin.
  • "landingFeedback:hardOptout" : <void> same this, but triggered when the user has denied the permission, hence he's definitely optout
callbacksoptional<object>
  • "onSuccess" : <array> returning the events that have been listened
  • "onError" : <string> label expliciting the reason why no events have been listened
Example

7.3 Track plugin

Each command related to the Track Plugin uses an option <object> and callbacks <object> (containing <function>).

For example

 

The options <object> differ from each other. Each command has its own data to provided.

The callbacks <object> will tell if your command has been validated and will be treated. In this case the "onSuccess" provided function will be applied. Otherwise the "onError" function will provide you a <string> expliciting the error.

For the sake of clarity, we will only tell how to set your options <object> for each command (as the callbacks object is generic and straightforward to understand).

track:event

OptionsRequiredTypeDescription
idrequired<numeric>

Please provide a valid number (NaN will not be a valid value)
Please note that you can create custom event in the Advanced Settings section of our interface

detailsoptional<object>key - value set of data, used to details your event
For example

track:lead

OptionsRequiredTypeDescription
leadrequired<string>

 

valuerequired<string> you can also provide "now()" as the value, it will automatically replace the string as a formatted date
For example

track:cart

OptionsRequiredTypeDescription
itemrequired<object>

The item <object> will respect this format:

idoptional<string>The id of your cart, it could match the id provided in a purchase track event
For example

track:purchase

OptionsRequiredTypeDescription
idrequired<string>

 

pricerequired<numeric>please provide a valid number (NaN will not be a valid value)
currencyrequired<string> 
itemsoptional<array>

containing item <object> respecting this format:

For example

7.4 Collect plugin

collect:setOptinData

Use this command whenever you want to set the optin data value.

ArgumentRequiredTypeDescription
optionsyes<object>

an object with the optinData parameter

  • "optinData" : <Boolean> 
callbacksoptional<object>
  • "onSuccess" : <void> 
  • "onError" : <string> label error
For example


collect:getOptinData

Use this command to retrieve the optin data value

 

ArgumentRequiredTypeDescription
optionsnot used  
callbacksoptional<object>
  • "onSuccess" : <object> an object containing the optinData value

  • "onError" : <string> label error
For example

7.5 Facebook Messenger Plugin

fbMessenger:generateButton

Use this command to generate a Facebook Messenger button. You can create buttons as many as you want.

ArgumentRequiredTypeDescription
containerIdyes<string>the ID of your DOM Element that will contain the generated button
coloroptional<string>

a constant defining the color of the generated button. Available colors :

  • "blue" default if not provided
  • "white"
sizeoptional<string>

a constant defining the size of the generated button. Available sizes :

  • "standard"
  • "large" default if not provided
  • "xlarge"
callbacksoptional<object>
  • "onSuccess": <void>
  • "onError": <string> label expliciting the reason why no button has been generated
For example

  • No labels