Connect Window API

The Connect Window API exposes public functions that can be called to setup or make configuration changes to surveys to be displayed on the page.

Properties

This is a list of all properties that can be set on the window API.

NameDescriptionSample

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 properties below.

NameDescription

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

ParameterDescriptionValue TypeSupported ValuesRequired

customEventsOnly

Supress 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 have already answered the survey 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.subscriberId

Either subscriberId or apiDomain is required.

window.okeConnectApi.apiDomain

Either subscriberId or apiDomain is required.

Parameters

ParameterDescriptionValue TypeSupported ValuesRequired

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

ParameterDescriptionValue TypeRequired

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

ParameterDescriptionValue TypeRequired

productId

The product id being removed from cart.

string

Last updated