Surveys – Connect Window API
The Connect Window API exposes public functions that can be called to set up or make configuration changes to surveys displayed on the page.
Properties
This is a list of all properties that can be set on the window API.
| Name | Description | Sample |
|---|---|---|
window.okeConnectApi.subscriberId | Okendo subscriber id for connecting to your store. | 00000000-0000-0000-0000-000000000000 |
window.okeConnectApi.apiDomain | Shopify domain for connecting to your store. | {your-shopify-domain} |
window.okeConnectApi.channel | The survey channel being implemented. on-site or post-checkout. | on-site |
window.okeConnectApi.targetElementId | Optional target element id in which to display an embedded survey. | okendo-survey |
window.okeConnectApi.checkout.orderId | Order id to associate with the customer and survey response. | 5179739177206 |
window.okeConnectApi.checkout.subtotalPrice | Price of the order used for order value conditions as well as revenue attribution. | 100 |
window.okeConnectApi.checkout.email | Used to attribute orders to survey responses. | user@example.com |
window.okeConnectApi.checkout.lineItems | An array of product ids being purchased. Used for cart content conditions. | 112233, 112244 |
Functions
setup
Initialises the surveys scripts on the page.
Example Usage
window.okeConnectApi.setup();
Properties
Before calling setup, you should set the following properties:
| Name | Description |
|---|---|
window.okeConnectApi.subscriberId | Either subscriberId or apiDomain is required. |
window.okeConnectApi.apiDomain | Either subscriberId or apiDomain is required. |
window.okeConnectApi.channel | on-site or post-checkout. |
window.okeConnectApi.targetElementId | An optional target element id to place an embedded survey in. |
Parameters
| Parameter | Description | Value Type | Supported Values | Required |
|---|---|---|---|---|
customEventsOnly | Suppress all page event triggers to allow manually triggering custom event surveys after initialisation. | boolean | true, false | ❌ |
raiseCustomEvent
Raise a custom event to potentially trigger a given survey. Display frequency rules are followed by default, which can prevent a survey from being displayed to a given user (for example, if they already answered it in their session).
Example Usage
window.okeConnectApi.raiseCustomEvent('product-survey');
Properties
You should set one of these properties before you can raise a custom event.
| Name | Description |
|---|---|
window.okeConnectApi.subscriberId | Either subscriberId or apiDomain is required. |
window.okeConnectApi.apiDomain | Either subscriberId or apiDomain is required. |
Parameters
| Parameter | Description | Value Type | Supported Values | Required |
|---|---|---|---|---|
eventName | The name of the event on the survey to show. | string | — | ✅ |
forceShow | Flag to ignore all display rules and show the survey. Defaults to false. | boolean | true, false | ❌ |
addToCart
Raise an add to cart event to trigger any add-to-cart surveys or to support a remove-from-cart trigger later. Add and remove from cart events rely on a cached list of products to store state between events.
Example Usage
window.okeConnectApi.addToCart('11223344');
Parameters
| Parameter | Description | Value Type | Required |
|---|---|---|---|
productId | The product id being added to cart. | string | ✅ |
removeFromCart
Raise a remove from cart event to trigger any remove-from-cart surveys.
Example Usage
window.okeConnectApi.removeFromCart('11223344');
Parameters
| Parameter | Description | Value Type | Required |
|---|---|---|---|
productId | The product id being removed from cart. | string | ✅ |