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

Skip to end of metadata
Go to start of metadata

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
  • No labels