1. Help Center
  2. ShoeAI Documentation
  3. Implementing the ShoeAI Scripts (mandatory)

ShoeAI Loader Script

The ShoeAI Loader Script is the primary script of the ShoeAI experiences across your online store. This Script is placed on the PDP, PLP, Landing Page, and all pages where the ShoeAI experiences are available to shoppers.

 

Place this script before the closing </body> tag

<script type="text/javascript" async src="https://shoesize.me/assets/plugin/loader.js" />

 

Setting up Loader Script parameters

There are two options for setting up the parameters. 

Option 1. Defining the ShoeSizeMe_loader.settingParams object.

Define a ShoeSizeMe_loader object containing a "settingParams" key defined as an object containing the mandatory and optional attributes. 

<script>
ShoeSizeMe_loader = {
settingParams:{
  shopID:"SHOP_ID",
locale:"en",
zeroHash:"xxxxxxxxxx",
scale:"eu"
}
}
</script>
<script type="text/javascript" async src="https://shoesize.me/assets/plugin/loader.js" />

Option 2. Define an Object inside the loader script

Place the JSON inside the script tag. 

<script type="text/javascript" async src="https://shoesize.me/assets/plugin/loader.js">
{
shopID:"SHOP_ID",
locale:"en",
zeroHash:"xxxxxxxxxx",
scale:"eu"
}
</script>

Mandatory attributes

Attribute Type Description Example
shopID Number Shop Id provided by shoesize  123456
locale String The language displayed inside ShoeAI "en","es","de"
scale String Shoe scale used for products  "us", "uk", "eu"
zeroHash String Hashed customer email. If not available leave it as an empty string e925cf32f2e201ba1ae938b9bd703d54

Example:

{
shopID:"SHOP_ID",
locale:"en",
zeroHash:"xxxxxxxxxx",
scale:"eu"
}

 

Optional attributes

Attribute Type Description
init boolean If set to false the loader will not initialize itself. 
To initialize manually call ShoeSizeMe_loader.init()
targetGender String Determines which reference gender is pre-selected in ShoeAI UI.  ( "male" or  "female" )
action boolean Used on PLP, if set to false it prevents the ShoeAi label from opening the experience on click. 
outputGender String Determines the target gender output on the recommendation page.  ( "male" or  "female" )
kids boolean Enable / Disable the kid option inside the touchpoint experience. 
logs boolean Enable / Disable console logs

Example:

{
...
init: false,
 targetGender: "male",
 action: false,
 outputGender: "female",
kids: true,
logs: false
}

Callback Attributes

Callback functions are used to get the data required to enable different ShoeAI outcomes.
E.g. Add-size-to-cart, new size recommendation, size-sold-out redirection. 

To see a full list of the callbacks payloads available, click the name of the Attribute listed below: 

Attribute Triggered when..
newRecommendation a shoe get a recommendation
inCart the user clicks "Add to cart" from within the experience
alternatives the user is recommended a size that is sold out and clicks the re-directing button
touchpoint the user completes the ShoeAI UI on landing page and clicks "to your results"

Example:

{
...
newRecommendation: function(data){},
inCart: function(data){},
alternatives: function(data){},
touchpoint: function(data){}
}

Attributes options

// Locale

ar
cs
da
de
de-CH
de-CH-formal
de-formal
el
en
en
es
fi
fr
fr-formal
it
ka
nl
pt-BR
ru
sk-SK
sv-SE
tr-TR
zh
zh-TW


// Scale

eu
uk
us
bra
js
tw
cl
col
arg
it
fr
de
rus
mx
aus
chn
kr
rwm


IN CART PAYLOAD

The relevant parameters to add the product to the cart are scale and recom_size.

{
 "shoe_id":"700",
   "scale":"eu",
   "available":true,
   "gender":"male",
   "recom_size":{
      "target_gender":"unisex",
      "eu":"42.0",
      "style_eu":"",
      "uk":"8.5",
      "style_uk":"",
      "us_m":"8.5",
      "style_us_m":"",
      "us_w":"10.5",
      "style_us_w":"",
      "jp":"27.0",
      "style_jp":"",
      "bra":"40.0",
      "style_bra":"",
      "arg":"",
      "style_arg":"",
      "tw":"",
      "style_tw":"",
      "chn":"42.0",
      "style_chn":"",
      "cl":"41.0",
      "style_cl":"",
      "col":"40.0",
      "style_col":"",
      "rus":"",
      "style_rus":"",
      "mx":"",
      "style_mx":"",
      "aus_m":"",
      "style_aus_m":"",
      "aus_w":"",
      "style_aus_w":"",
      "kr":"280.0",
      "style_kr":"",
      "it":"42.0",
      "style_it":"",
      "fr":"",
      "style_fr":null,
      "de":"",
      "style_de":"",
      "mp":"",
      "style_mp":"",
      "rmw_m":"",
      "style_rmw_m":"",
      "rmw_w":"",
      "style_rmw_w":"",
      "sample_sizes":0
 },
   "user":{
      "gender":"male",
      "yearOfBirth":null,
"footWidth":"width_normal",
      "footArch":1,
      "footType":"type_normal",
    "status":"recognised",
      "last_session_click":"2022-10-18T10:19:33.907+00:00",
  "auth_token":"12345678",
      "first_name":"Anonymous",
      "locale":"en",
      "scale":"eu",
      "brand":{
         "id":1969,
       "name":"Adidas",
      "image":"https://st-plugin.shoesize.me/..."
      },
    "model":{
         "id":862288,
         "name":"Samba",
       "image":"https://st-plugin.shoesize.me/..."
      },
    "ref_size":{
         "id":32830,
         "eu":42,
         "uk":8,
         "us_m":8.5,
         "jp":26.5,
         "rus":40.5,
         "col":39.5,
         "arg":40,
         "cl":40.5,
         "mx":6.5,
         "bra":40,
         "aus_m":8.5,
         "chn":260,
         "it":42
      },
      "ref_scale":"eu",
    "ref_category_id":null,
      "size":{
         "id":32830,
         "eu":"42.0",
         "uk":"8.0",
         "us_m":"8.5",
         "us_w":"9.5",
         "jp":"26.5",
         "bra":"40.0",
         "arg":"40.0",
         "tw":"",
         "chn":"260.0",
         "cl":"40.5",
         "col":"39.5",
         "rus":"40.5",
         "mx":"6.5",
         "aus_m":"8.5",
         "aus_w":"9.5",
         "kr":"",
         "it":"42.0",
         "fr":"",
         "de":"",
         "mp":"",
         "rmw_m":"",
         "rmw_w":""
    }
 }
}

 

ALTERNATIVES PAYLOAD

{
  "shoe_id": "700",
    "scale": "eu",
    "available": "none",
    "gender": "male",
    "recom_size": {
        "target_gender": "unisex",
        "eu": "none",
        "style_eu": "none",
        "uk": "none",
        "style_uk": "none",
        "us_m": "none",
        "style_us_m": "none",
        "us_w": "none",
        "style_us_w": "none",
        "jp": "none",
        "style_jp": "none",
        "bra": "none",
        "style_bra": "none",
        "arg": "none",
        "style_arg": "none",
        "tw": "none",
        "style_tw": "none",
        "chn": "none",
        "style_chn": "none",
        "cl": "none",
        "style_cl": "none",
        "col": "none",
        "style_col": "none",
        "rus": "none",
        "style_rus": "none",
        "mx": "none",
        "style_mx": "none",
        "aus_m": "none",
        "style_aus_m": "none",
        "aus_w": "none",
        "style_aus_w": "none",
        "kr": "none",
        "style_kr": "none",
        "it": "none",
        "style_it": "none",
        "fr": "none",
        "style_fr": "none",
        "de": "none",
        "style_de": "none",
        "mp": "none",
        "style_mp": "none",
        "rmw_m": "none",
        "style_rmw_m": "none",
        "rmw_w": "none",
        "style_rmw_w": "none"
  },
    "user": {
        "gender": "male",
        "yearOfBirth": null,
        "footWidth": "width_normal",
      "footArch": 1,
        "footType": "type_normal",
        "birthYear": null,
        "status": "recognised"
        "brand": {
            "id": 1969,
            "name": "Adidas"
        },
      "brandSrc": "https://plugin.shoesize.me/brands/1969/thumb_071a0d49-617e-43ff-a374-f0facdf079e4.jpg",
        "model": {
            "id": 862288,
            "name": "Samba",
            "image": "https://st-plugin.shoesize.me/plugin/top_shoes/Samba_862288-d9d6536233de51d190a6740ce0f808e7.jpg"
        },
      "ref_size": {
            "id": 22998240,
            "eu": 55.66,
            "style_eu": "55 2/3",
            "uk": 19,
            "us_m": 20
        },
        "ref_scale": "eu",
        "ref_size_id": 22998240,
        "ref_category_id": null,
        "last_session_click": "2022-10-18T12:38:46.281+00:00",
      "auth_token": "12345678",
        "first_name": "Anonymous",
        "locale": "en",
        "scale": "eu",
        "size": {
            "id": 22998240,
            "eu": "55 2/3",
            "uk": "19.0",
            "us_m": "20.0",
            "us_w": "",
            "jp": "",
            "bra": "",
            "arg": "",
            "tw": "",
            "chn": "",
            "cl": "",
            "col": "",
            "rus": "",
            "mx": "",
            "aus_m": "",
            "aus_w": "",
            "kr": "",
            "it": "",
            "fr": "",
            "de": "",
            "mp": "",
            "rmw_m": "",
            "rmw_w": ""
      }
  }
}

 

TOUCHPOINT PAYLOAD


{
  "pages": {
    "gender": {
      "value": "men",
      "map_value": "male"
    },
    "shoe_type": {
      "value": "shell_cordovan",
      "map_value": null
    }
  },
  "reference_shoe": {
    "brand": {
      "name": "Adidas",
      "id": 1969
    },
    "model": {
      "name": "Samba",
    "src": "https://plugin.shoesize.me/top_shoes/Samba_862288-d9d6536233de51d190a6740ce0f808e7.jpg",
      "id": 862288,
      "is_category": false
    },
    "size": {
      "size": {
        "id": 32788,
        "eu": 40,
        "uk": 6.5,
        "us_m": 7,
        "jp": 25,
        "rus": 38.5,
        "col": 37.5,
        "arg": 38,
        "cl": 39,
        "mx": 5,
        "bra": 38,
        "aus_m": 7,
        "chn": 245,
        "it": 40
      },
      "scale": "eu"
    }
  },
  "user": {
    "gender": 0,
    "year_of_birth": null,
    "foot_width": 1,
    "foot_arch": 1,
    "user_type": 0
  }
}

 

newRecommendation PAYLOAD

The relevant parameters to add the product to the cart are scale and recom_size.

{
  "shoeId": "P173026",
  "size": {
    "target_gender": "kids_unisex",
    "eu": "none",
    "style_eu": "none",
    "uk": "none",
    "style_uk": "none",
    "us_m": "none",
    "style_us_m": "none",
    "us_w": "none",
    "style_us_w": "none",
    "jp": "none",
    "style_jp": "none",
    "bra": "none",
    "style_bra": "none",
    "arg": "none",
    "style_arg": "none",
    "tw": "none",
    "style_tw": "none",
    "chn": "none",
    "style_chn": "none",
    "cl": "none",
    "style_cl": "none",
    "col": "none",
    "style_col": "none",
    "rus": "none",
    "style_rus": "none",
    "mx": "none",
    "style_mx": "none",
    "aus_m": "none",
    "style_aus_m": "none",
    "aus_w": "none",
    "style_aus_w": "none",
    "kr": "none",
    "style_kr": "none",
    "it": "none",
    "style_it": "none",
    "fr": "none",
    "style_fr": "none",
    "de": "none",
    "style_de": "none",
    "mp": "none",
    "style_mp": "none",
    "rmw_m": "none",
    "style_rmw_m": "none",
    "rmw_w": "none",
    "style_rmw_w": "none"
  },
  "recom_size": {
    "target_gender": "kids_unisex",
    "eu": "none",
    "style_eu": "none",
    "uk": "none",
    "style_uk": "none",
    "us_m": "none",
    "style_us_m": "none",
    "us_w": "none",
    "style_us_w": "none",
    "jp": "none",
    "style_jp": "none",
    "bra": "none",
    "style_bra": "none",
    "arg": "none",
    "style_arg": "none",
    "tw": "none",
    "style_tw": "none",
    "chn": "none",
    "style_chn": "none",
    "cl": "none",
    "style_cl": "none",
    "col": "none",
    "style_col": "none",
    "rus": "none",
    "style_rus": "none",
    "mx": "none",
    "style_mx": "none",
    "aus_m": "none",
    "style_aus_m": "none",
    "aus_w": "none",
    "style_aus_w": "none",
    "kr": "none",
    "style_kr": "none",
    "it": "none",
    "style_it": "none",
    "fr": "none",
    "style_fr": "none",
    "de": "none",
    "style_de": "none",
    "mp": "none",
    "style_mp": "none",
    "rmw_m": "none",
    "style_rmw_m": "none",
    "rmw_w": "none",
    "style_rmw_w": "none"
  },
  "scale": "eu",
  "available": "none",
  "gender": null,
  "kidsshoe": true
}