1. Help Center
  2. ShoeAI Documentation
  3. ShoeAI Scripts Additional Documentation

Available Functions

List of all the available functions

Initialisation and settings

Function Name Description
init initialise ShoeAi experience
openPlugin open the Shoeai experience
closeWindow close ShoeAi experience
setConfigParam change the initial configuration dynamically
getConfig
returns the current ShoeAI configuration
changeLanguage Change the language dynamically
updateShoeInfo Update the product image, brand and name inside the shoeAI

 

Filtering and pagination

Function Name Description
loadMultipleButtons Get a recommendation for dynamically added products ( pagination and filtering )
rebuildAllButton re-inject the ShoeAI button
rebuildAndUpdate re-inject the ShoeAI button and update the product availability 

 

Zero interaction

Function Name Description
user.zeroInteraction.add Login the zero Interaction user
user.zeroInteraction.remove Logout the zero Interaction user
user.zeroInteraction.update

Replace the zero Interaction user with a new one

 

Other useful functions

Function Name

Description
deleteButtons Clear the stored buttons data
getRecomData return the latest button recommendation
getUserData returns the customer stored data
updateShoeAvab Re-process the product sizes availability
updateShoeGender Update the target gender inside the ShoeAi. It will preselect the gender tab

 

Functions Details

ShoeSizeMe_loader.init

By default the ShoeAI experience initialise itself.
If you need to delay the initialisation you can use the loader setting parameter init:false, and call this function to initialise the experience manually. 

ShoeSizeMe_loader.setConfigParam(attribute,value)

Used to replace the initial configuration dynamically. 
It accepts 2 parameters: attribute and value. 
The attribute it's the key of the current configuration that needs to be replaced. 
In case of nested keys, set the attribute as a string of keys separated by a "."

e.g.  ShoeSizeMe_loader.setConfigParam('callbacks.inCart',false)

ShoeSizeMe_loader.changeLanguage(lang:string)

To change the language dynamically pass to the function a ISO 2 Letter Language Code string. 

 

ShoeSizeMe_loader.updateShoe(shoeID,brand,model,image,gender)

Updated the product information inside the ShoeAI experience. 
The only required parameter is the shoeID, passed as a string. 
The rest of parameter are optionals.
If passed, they will be used to update the ShoeAI. 
Otherwise the function will parse the website to the get the data. 


ShoeSizeMe_loader.loadMultipleButtons([shoeIDs],forceReload,forceNewShoe)

Function used after async pagination or filtering to re-inject the products recommendation label.
It will re-render the labels for the shoes already processed and get a new recommendation for the new product ids. 

All the parameters are optionals: 

  • [ShoeIds]
    • Array for shoeID strings, or null.
      If passed the function will only process the provided ids. 
      If no Ids are passed, the function will parse the DOM to get all the data-shoeIds, and split them between already processed ids and new ids.
      Useful in case of infinite pagination to avoid extra page parsing.
  • forceReload
    • Boolean.
      If set to true, all the labels exiting ShoeAI labels HTML will be re-processed. 
  • forceNewShoe
    • Boolean.
      If set to true, all the Ids will be treated as new Ids, causing a re-process of all the recommendations, even for products that already have a recommendation. 

ShoeSizeMe_loader.rebuildAllButton(shoeID) 
Function used to re-inject the button HTML.
Used when the HTML of the product is dynamically and the button must be created again. 
If a shoeID is passed, it will only process the ID provided, otherwise the DOM will be scraped to get all the data-shoeid avaialable on the page. 


ShoeSizeMe_loader.rebuildAndUpdate(shoeID) 
Function used to re-inject the button HTML and re-process the availability. 
If requires a shoeID parameters. 
Often used on PDP color switch, when the different colours share the same productID and the shoe information must be re-processed. 

ShoeSizeMe_loader.user.zeroInteraction.add(zeroHash) 

Used to add the zeroInteraction after a dynamic login, for example on SPA websites. 
Requires the customer m5 hashed email as a parameter. 


ShoeSizeMe_loader.user.zeroInteraction.remove(
) 

Used to remove the zeroInteraction after a dynamic login, for example on SPA websites. 

ShoeSizeMe_loader.getRecomData(shoeid) 

Returns the recommendation of a product. 
The function requires a shoeID.  
Product information is also accessible from the object ShoeSizeMe_loader.buttonsList. 

ShoeSizeMe_loader.updateShoeAvab(shoeID) 

Force the parsing of the product availability. To get a new recommendation after the availability has been updated the function loadMultipleButtons([shoeid],null,true) needs to be called.

 

ShoeSizeMe_loader.updateShoeGender(gender) 

Requires a string "male", "female" or "kids". 
It will preselect the target gender inside the shoeAI