Skip to main content
Version: 1.0

Add JS snippet

Robosize needs the following JS snippet to be added to the product page. It provides the necessary information for the widget to work consisting of the shop domain and the product ID.

<script>
window.Robosize = window.Robosize === undefined ? {} : window.Robosize;
Robosize.shop = "DOMAIN";
Robosize.product = "PRODUCT_ID";

!function () {
const t = document.createElement("link");
t.setAttribute("href", "https://d3elw2t9mvtwj8.cloudfront.net/app_bundle.css");
t.setAttribute("id", "if-css");
t.setAttribute("rel", "stylesheet");
t.setAttribute("type", "text/css");
document.body.insertBefore(t, document.body.firstChild);
const e = document.createElement("script");
e.setAttribute("id", "if-script");
e.setAttribute("src", "https://d3elw2t9mvtwj8.cloudfront.net/app_bundle.js");
document.head.insertBefore(e, document.head.firstChild);
}();
</script>
Product ID

The PRODUCT_ID is the ID of the product in your system. If you synced your products using the API this ID is similar to STORE_ID.

Snippet placement

The snippet should be placed as close to the opening <body> tag as possible. It loads the widget asynchronously and does not block the page rendering.