API Reference

API reference of methods and functions available in the SDK.

API Method Arguments Description
.enableAnalytics() Boolean Whether or not analytics is enabled. If set to false, the SDK will not raise any events except Registration requests.
.getAPIKey() NA Returns the API Key for the Web Push App. The API Key identifies the platform for the Web Push app.
.getEdti() NA Returns the external device tracking ID when set using the .setEdti() method. The external device tracking ID is the identifier for data captured by other SDK's such as external analytics data about a device.
.getNotificationPermission() NA Returns the Web Push Notification Permission status for a website visitor. Values include: "Allowed" or "Blocked".
.getOptInOptOutStatus() NA Returns the website visitor's Web Push Permission Status. Returns I if user is opted in for web push notifications, or else O for opted out.
.getUserId() NA Returns user ID when set using the .setUserId() method.
.getVisitorId() NA Returns the Visitor ID of the website visitor. Every visitor to the website will be assigned a unique Visitor ID. You can also use the Visitor ID to send test Web Push Messages.
.isAnalyticsEnabled() NA Returns true or false, determined on the last .enableAnalytics() method invocation. By default returns true.
.raiseConversionEvent() webPushManagerAPI.CONVERSION_TYPE, [conversionParams], [onlyOnce]) Raises a conversion event based on last notification received. First argument of type webPushManagerAPI.CONVERSION_TYPE.OTHERS and two optional parameters. Second argument is a JSON object to pass any parameters to the Responsys servers. Third parameter onlyOnce is of type boolean, if set to true, then the conversion event will raise only once for the last received notification.
.raisePurchaseEvent() webPushManagerAPI.CONVERSION_TYPE, [conversionParams], [onlyOnce]) Raises a conversion event (purchase) based on last notification received. First argument of type webPushManagerAPI.CONVERSION_TYPE.PURCHASE. Second argument is a JSON object that should contain "ORDERID, ORDERTOTAL, NUMITEMS, and/or CUSTOMERID" attributes and any other user defined attributes if any to the Responsys servers. Third parameter onlyOnce is of type boolean, if set to true, then the conversion event will raise only once for the last received notification.
.register() NA Triggers a registration event to the Responsys server, only if there are changes in the registration payload.
.resetEdti() NA Resets the external device tracking ID and trigger a registration event to the Responsys server.
.resetEngagementContext() NA Reset all engagement information (to nil). When you reset the engagement context, no more engagement will be reported after calling this method until: a Removes the last received notification context from the client, so that if the user raises a purchase or conversion events based on last notificaiton received, it will not raise those events to the Responsys server.
.resetUserId() NA Resets or clears a user ID (if any) and raise a registration event to the Responsys server.
.setAppversion() String Used to set the end user's website version, which is tracked in the Responsys Web Push Channel List (APP_VERSION_). This internally triggers a registration event to the Responsys server.
.setEdti() String Sets the external device tracking ID of the user and raises a registration event to the Responsys server.
.setUserId() String Sets the currently logged in user and raises a registration event to the Responsys server.
.unRegister() NA Unregisters the notification subscription for the website visitor. The Responsys server will no longer send any web push notifications to the current user.