The Synerise AI Developer Hub

Welcome to the Synerise AI developer hub. You'll find comprehensive guides and documentation to help you start working with Synerise AI API as quickly as possible, as well as support if you get stuck.
Let's jump right in!

Integrating Synerise AI Tracker

Synerise AI Tracker is a JavaScript library responsible for two different matters.
The first is that it allows you to send events from your webpage directly to Synerise AI without the need of using our Events API and the latter is that it enables also to show AI recommendations on your webpage.

To install tracker on your web page paste a JavaScript code presented in your Synerise AI Dashboard. It looks similar to this script below:

<script>
   (function(s, y, n, e, r, i, se) {
   var z = y.createElement(n), x = y.getElementsByTagName(n)[0];z.async = 1;z.src = e;x.parentNode.insertBefore(z, x);
   z.onload = z.onreadystatechange = function() {var rdy = z.readyState;
       if(!rdy || /complete|loaded/.test(z.readyState)){snrAI.init(i,r);z.onload = null;z.onreadystatechange = null;}};
})(window, document, 'script', 'https://ai.snrbox.com/synerise-ai-sdk.js', 'onSyneriseAILoad', '...');
 </script>

This script provides functionality to send page.visit, product.addToCart and transaction.charge events to Synerise AI using snrAI.addEvent JavaScript function.

The page.visit event is sent automatically upon every page view. However if the website is created using the SPA (Single Page Application) technique, you can send the event using the following method:

snrAI.addEvent('page.visit');

This will automatically send appropriate event to Synerise AI.

In order to send a product.addToCart event informing Synerise AI that user just added a product to the cart, you need to invoke following code:

snrAI.addEvent('product.addToCart', {
    'productRetailerPartNo': <string product ID>,
    'productPriceAmount': <float product current unit price>,
    'productOriginalPriceAmount': <float product normal unit price>,
    'productPriceCurrency': <string currency in ISO 4217 format e.g. PLN, EUR>,
    'productTitle': <string product name>,
    'productCategory': <optional string with product category hierarchy>,
    'productQuantity': <float product quantity with default 1.0>
});

Field productRetailerPartNo must be a product identifier that matches a product identifier in the provided product feed. Fields productPriceAmount and productOriginalPriceAmount represent prouduct's discounted price and product's normal sales price, if there is no discount, then both prices are equal.

In order to send transaction.charge event you need to call snrAI.addEvent function with transaction.charge event name and a list of order items.
Each order item has following format:

var orderItem = {
    'orderId' : <int order id>,
    'productRetailerPartNo': <string product ID>,
    'productPriceAmount': <float product current price>,
    'productOriginalPriceAmount': <float product normal price>,
    'productPriceCurrency': <string currency in ISO 4217 format e.g. PLN, EUR>,
    'vatRate': <int VAT rate for product>,
    'productTitle' : <string product name>,
    'productCategory': <optional string with product category hierarchy>,
    'productQuantity' : <float quantity>    
}

Here is how sample request may look like:

snrAI.addEvent('transaction.charge', [
    {
        'orderId' : 1463,
        'productRetailerPartNo': '13462344',
        'productPriceAmount': 1532.52,
        'productOriginalPriceAmount': 2352.43,
        'productPriceCurrency': 'PLN',
      	'vatRate': 23,
        'productQuantity' : 1.0,
        'productTitle' : 'Example product',
      	'productCategory' : 'Products > Subcategory1 > Subcategory 2'
    },
    {
        'orderId' : 1463,
        'productRetailerPartNo': '6351350',
        'productPriceAmount': 159.90,
        'productOriginalPriceAmount': 259.90,
        'productPriceCurrency': 'PLN',
      	'vatRate': 8,
        'productQuantity' : 2.45,
        'productTitle' : 'Other example product',
      	'productCategory' : 'Products > Subcategory1 > Subcategory 3'
    }
]);

Integrating Synerise AI Tracker


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.