Quizzes - Connect Window API

The Connect Window API exposes public functions that can be called to show or configure custom events for quizzes to be displayed on the page.

Functions

showQuiz

The showQuiz event can optionally be used to trigger display of Okendo Quizzes on your storefront in a modal.

Example Usage

<script>
	window.okeConnectApi.showQuiz(channelQuizId, subscriberId);
</script>

Custom Liquid Usage

<a  
  href="#" 
  onclick="okeConnectApi.showQuiz('your-channel-quiz-id', 'your-subscriber-id')" 
  class="button button--full-width">Take our quiz
</a>

Parameters

Parameter
Description
Value Type
Required

channelQuizId

Can be found in the install dialog of your quiz

string

subscriberId

Your Okendo customer identifier.

string

recommendedProductMounted

The recommendedProductMounted event is triggered when an individual product recommendation is mounted in the application. It provides an opportunity for merchants to insert custom HTML or other custom product display functionality, allowing them to further customize the presentation of recommended products.

Example Usage

Parameters

Parameter
Description
Value Type
Required

sectionContent

HTML of the recommended product to be rendered.

html

product

A payload representing the product to be recommended.

JSON

recommendedProductsMounted

The recommendedProductsMounted event is triggered when all product recommendations are mounted in the application. It provides an opportunity for merchants to insert custom HTML or other custom product display functionality for the entire recommendation page. This allows merchants to have full control over the presentation of the entire recommendation section.

Example Usage

Parameters

Parameter
Description
Value Type
Required

recommendationSection

The html element representing the entire recommendation section.

html

products

A JSON object representing all recommended products to be displayed on the recommendation page.

JSON

generateCartLineItemProperties

The generateCartLineItemProperties event is triggered when a product is added to the cart from the recommendation page. It provides an opportunity for merchants to insert custom data into the cart line items, allowing them to enhance the cart experience with personalized information.

Example Usage

Parameters

Parameter
Description
Value Type
Required

addToCartButtonId

id of the add to cart button element that was clicked

string

product

A JSON object representing the product that was added to the cart from the recommendation page.

JSON

Events

oke_quizCapture_addToCart

The oke_quizCapture_addToCart event is used by Okendo Quizzes to notify the store that a customer intends to “Add to Cart” one or more recommended products.

Example Usage

Headless Events

Typically used in headless implementations. See the below guide for an explanation and examples of how to setup quizzes on headless instances:

Installing Quizzes on Headless Instances

oke_quizCapture_addToCartSuccess

oke_quizCapture_addToCartFailure

oke_connect_cart_itemVariantAdded

oke_connect_checkout_orderSubmitted

Last updated