Installing Connect Surveys on Headless Instances

Standard Implementations

Introduction

There are multiple ways to configure and setup headless Connect. There are two main channels it supports:

  • on-site

  • post-checkout

Both channels support multiple different modes of configuration. Either by passing query string parameters to the script or by creating meta tags inside the page header.

On Site

To display an on site survey, the system chooses from a prioritised list of surveys for the on site channel. From highest priority down, the system choses the first active survey that matches conditions and that the user is eligible for answering.

To implement on site surveys, you can add our surveys script tag to the header of the page(s) with your store Shopify domain.

Example Usage

<script type="text/javascript"
        src="https://surveys.okendo.io/js/okendo-connect.headless.js?shop={your-store}.myshopify.com&channel=on-site&auto_initialise=true"
        async>
</script>

Parameters

These query string parameters can be added to the script src.

ParameterDescriptionValue TypeSupported ValuesRequired

shop

The store identifier for example okendo-seahorse-emporium.myshopify.com

string

channel

The Okendo Survey channel to load a list of surveys from.

string

on-site, post-checkout

auto_initialise

Flag to indicate if the API setup function should be run on page load. Defaults to false

boolean

true, false

customEventsOnly

Flag to indicate if page event triggers to show surveys should be supressed. Defaults to false

boolean

true, false

targetElementId

Optional page element id to place the survey inside of.

string

Post Checkout

To display a post checkout survey, the system chooses from a prioritised list of surveys for the post checkout channel. From highest priority down, the system choses the first active survey that matches conditions and that the user is eligible for answering.

Post-checkout requires extra data needed for the decision making process on which survey to display to a customer. This data is used to determine which post-checkout conditions and triggers match.

If only using a simple post checkout survey without conditions you can use the same setup as the above on site section.

If you want to use any of the following conditions, you will need to either use the javascript API properties or meta tags as explained below:

  • Order value is at least

  • Order value is at most

  • Purchased product

  • Cart contents do not include

  • New Customers

  • Repeat Customers

Example Usage

<html>
<head>
    <meta name="oke:subscriber_id" content="{your-subscriber-id}" />
    <meta name="oke:target_element_id" content="okendo-survey" />
    <meta name="oke:order_id" content="1508506" />
    <meta name="oke:order_subtotal_price" content="100.00" />
    <meta name="oke:cart_content_product_ids" content="6911181521050, 6911187714202" />
    <meta name="oke:auto_initialise" />
    <script type="text/javascript"
        src="https://surveys.okendo.io/js/okendo-connect.headless.js?channel=post-checkout" async>
    </script>
</head>
<body>
    <div style="width: 300px; height: 400px;">
        <div id="okendo-survey"></div>
    </div>
</body>
</html>

Parameters

The channel parameter needs to be provided as a query string parameter to the script src.

ParameterDescriptionValue TypeSupported ValuesRequired

channel

The Okendo Survey channel to load a list of surveys from.

string

on-site, post-checkout

Tags

Tag NameDescriptionExample Value

oke:subscriber_id

Your Okendo subscriberId.

00000000-0000-0000-0000-000000000000

oke:target_element_id

The id you have given the element on the page where you want embedded surveys to be displayed. Only required for embedded.

okendo-survey

oke:order_id

The order id used to support revenue attribution and linking the order to the survey response. See Shopify.checkout.order_id

5179739177206

oke:order_subtotal_price

The order value to be used for matching order value conditions. Value should match your store currency.

100

oke:cart_content_product_ids

A list of product ids being purchased. Used for cart contains or not contains conditions. Separate by commas.

6911181521050, 6911187714202

oke:auto_initialise

Flag to indicate if the API setup function should be run on page load. If not included you will have to manually call setup on the Javascript API window object okeConnectApi

Custom Implementations

See the link below for details on API references to support your custom implementation.

pageConnect Window API

Last updated