Skip to main content

Implementing call to action on size recommendation screen

EyeFitU SizeEngine SDK exposes an API which allows to change default Continue button on size recommendation screen to a call to action, e.g. Add to Cart.

Defining call to action button

To change action text set a data-prompt-button-text attribute on a widget element:

[ ... other required attributes ]
data-prompt-button-text="Add {X} to Cart"

Here {X} is a placeholder, which will be replaced with selected size.

Call to action API

EyeFitU SizeEngine SDK emits a click event on call to action button, which you could handle according to your needs.

We have seen following use case:

  • add garment in selected size to the cart
  • select recommended size on a product details page
  • send recommended and selected sizes into store analytics

For all these use cases you need to listen for the eyefitu event on the widget element (DOM element marked with data-eyefitu-sizing-widget atribute):

.addEventListener('eyefitu', (event) => {
// `recommendedSize` is a size recommended by EyeFitU.

// `selectedSize` is a size selected by the user according
// to personal preferences.

Integration with eCommerce platform

Implementation of the Add to Cart function requires integration with eCommerce platform. Please consult your technology provider for implementing this integration.


On Shopify you should call Cart API to add item to cart.

.addEventListener('eyefitu', (event) => {
const variantId = lookupVariantBySize(event.detail.selectedSize);'/cart/add.js', {
items: [
quantity: 1,
id: variantId