Sizebay Tracker on your code

In order for the plugin to be able to correctly capture this data, it is necessary for the platform to call it correctly on each screen that the user could access. Following are the steps (or screens) in which calls to our plugin are needed so we can group the usage data correctly and generate consistent indicators for your day-to-day activities. In all the steps described below, it will be necessary to import the Sizebay script into your e-commerce platform. To do so, just include the following line in your HTML:

<script src="https://vfr-v3-production.sizebay.technology/V4/implantation/index.js"></script>

Tracking a Product Page

All Page Views indicators computed by the plugin are obtained by users accessing the products page. If you already have the Virtual Fitting Room integrated, you can skip to the next topic, since the plugin already collects Page Views automatically.

If you do not have the plugin previously configured on your product pages, just run the following line of code as soon as the product page opens (DOM Ready or Page Loaded event from browsers):

Adding products to the cart

Another important step in the process is when the user adds a product of interest to the shopping cart. This moment is important, and indicates that the user has actually engaged with the product (or with the offer). To add this information to your Sales Funnel, just call the following line of code into your system.

const payload = {
  products: [
    {
      permalink: 'https://www.your-store.com/product/product-example'
    }
  ]
}
const tenantId = 000

window.Sizebay.events.addToCart(payload, tenantId)

Important: The tenantId should be provided by our Support Team (support@sizebay.com)

E-commerces usually offer two types of experience to put items in the cart:

  • The inclusion of the cart asynchronously - where the user does not leave the product page, receives a notification that it has been added to the cart and continues to use the site normally.

  • Feedback that the product has been added to the cart by leaving the product screen and directing the user to a screen with all the items included in the cart so far.

If your platform makes the inclusion asynchronously, you should avoid placing this code associated directly with the click event on the add to cart button - especially when it validates the size or colors that were not selected by the user. For this information to be accurate and complete, it is important to send it only when the platform has the product properly saved in your cart.

If your platform redirects the user to the screen with all the items added to the cart, you can trigger the event as soon as the screen starts (DOM Ready or Page Loaded events from browsers). If it is not possible to distinguish which products were added to the shopping cart with those that were already in place, you can send all items added so far - previously added products will be disregarded.

Finalizing the order

The checkout page is the most important page in the process, as it represents the sale itself. It is through the sales indicators, including, that the exchanges/returns rate of the products sold are analyzed.

To add this data to your e-commerce indicators, just execute the following lines of JavaScript code:

const payload = {
  orderId: 'order01',
  currency: 'EUR,
  country: 'FR',
  items: [
    {
      permalink: 'https://www.your-store.com/product/product-example',
      price: 75,
      quantity: 1,
      size: 'P',
      feedProductId: "00000",
      sku: "A1P"
    }
  ]
}
const tenantId = 000

window.Sizebay.events.ordered(payload, tenantId)

Field

Type

Description

tenantId

string

Sizebay Store ID

orderId

string

Must be filled in with the order code generated as soon as the purchase is made. It is with this information that we will be able to track this shopping experience in case of a future exchanged/returned product

items

array

Array with the various items that were sold in this purchased order. There are no product limits to be included. Each product has the attributes described below:

permalink

string

Product URL. It must be the same used in the shopping cart

price

float

The price of the product sold

quantity

int

Number of itens

size

string

Clothing size ordered

feedProductId

string

Global product id (id for all variations)

sku

string

Id of product variation

currency

string

Currency applied to the ordered item

country

string

Country applied to the ordered item

Important: For the complete list of supported countries and currencies, please head over to the session Sizebay Tracker - Supported Countries and Currencies

Important: The tenantId should be provided by our Support Team (support@sizebay.com)

Important: The price of the product sold must be sent in your store's default currency. If your store sells in different currencies, convert the product price and send the value in the default currency. The values sent will be added up and shown in your store's reports, so it is very important that they are sent in a single currency.

Last updated