Skip to main content

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.

NameDescriptionSample
window.okeConnectApi.subscriberIdOkendo subscriber id for connecting to your store.00000000-0000-0000-0000-000000000000
window.okeConnectApi.apiDomainShopify domain for connecting to your store.{your-shopify-domain}
window.okeConnectApi.channelThe survey channel being implemented. on-site or post-checkout.on-site
window.okeConnectApi.targetElementIdOptional target element id in which to display an embedded survey.okendo-survey
window.okeConnectApi.checkout.orderIdOrder id to associate with the customer and survey response.5179739177206
window.okeConnectApi.checkout.subtotalPricePrice of the order used for order value conditions as well as revenue attribution.100
window.okeConnectApi.checkout.emailUsed to attribute orders to survey responses.user@example.com
window.okeConnectApi.checkout.lineItemsAn 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:

NameDescription
window.okeConnectApi.subscriberIdEither subscriberId or apiDomain is required.
window.okeConnectApi.apiDomainEither subscriberId or apiDomain is required.
window.okeConnectApi.channelon-site or post-checkout.
window.okeConnectApi.targetElementIdAn optional target element id to place an embedded survey in.

Parameters​

ParameterDescriptionValue TypeSupported ValuesRequired
customEventsOnlySuppress all page event triggers to allow manually triggering custom event surveys after initialisation.booleantrue, 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.

NameDescription
window.okeConnectApi.subscriberIdEither subscriberId or apiDomain is required.
window.okeConnectApi.apiDomainEither subscriberId or apiDomain is required.

Parameters​

ParameterDescriptionValue TypeSupported ValuesRequired
eventNameThe name of the event on the survey to show.string—✅
forceShowFlag to ignore all display rules and show the survey. Defaults to false.booleantrue, 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​

ParameterDescriptionValue TypeRequired
productIdThe 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​

ParameterDescriptionValue TypeRequired
productIdThe product id being removed from cart.string✅