sendProduct

This function must be called every time a visitor clicks on a product details page.

    var _ra = _ra || {};

    _ra.sendProductInfo = {
         "id": product_id,
         "name": "product_name",
         "url": "product_url",
         "img": "product_main_image_src",
         "price": product_price,
         "promo": product_promotional_price,
        "brand": {
            "id": brand_id,
            "name": "brand_name"
        },
       "category": [
            {
                "id": category_id,
                "name": "category_name",
                "parent": parent_category_id,
                "breadcrumb": [
                    {
                        "id": parent_category_id,
                        "name": "parent_category_name",
                        "parent": parent_of_parent_category_id
                    },
                    {
                        "id": parent_of_parent_category_id,
                        "name": "parent_of_parent_category_name",
                        "parent": false
                    }
                ]
            },
            ...
        ],
        "inventory": {
            "variations": true,
            "stock": {
                "variation-code-1": true,
                "variation-code-2": false,
                "variation-code-3": true
            }
        }
    };

    if (_ra.ready !== undefined) {
        _ra.sendProduct(_ra.sendProductInfo);
    }

sendProduct function parameters

Field Type Required Description
id number True The product item identifier, ie. itemcode. It should identify to the sold product, but not necessarily some specific variant of the product. Must be unique in your site
name text True The product name
url URL True Complete URL of the item. Must start with http:// or https://.
image URL True Complete URL of an image of the item
price number or text True Current product price. If the product is on promotion (price is reduced) then this parameter gets the value of the price before promotion was applied to the product (old price)
promo number or text False Promotional price (new price). When the product isn’t on promotion (no reduced price), send value 0
stock bool (0/1) True Stock of the product. For product in stock send value 1. When the product isn’t on stock send value 0
brand object True Details about product brand. If the product does not belong to any brand, send false value. The object containing brand details, has the following properties: id, name
brand.id number True The brand item identifier
brand.name text True Brand name
category array True An array that contains the product category. The category object should contain the following properties: id, name, parent
category[0].id number True The category identifier
category[0].name text True Category name
category[0].parent number, false True Id of parent category. If there isn’t any parent category, send false value
breadcrumb array True Array containing all the parent categories of the category to which the product belongs (in this array you must not add the product category). If the category does not have a parent category (category.parent is set false), send an empty array. Each parent category is sent as object and contains the following properties: id, name, parent
breadcrumb.id number True Category id
breadcrumb.name text True Category Name
breadcrumb.parent number, false True Id of parent category. If there isn’t any parent category, send false value
inventory object True Inventory details
inventory.variations true / false True True for products with variations. False for products without variations
inventory.stock true / false / object True For product with variations, you should send an object with stock for each variations
callback_function function False With this parameter you can define a function that runs itself after the action’s parent function executes

sendProduct function examples

sending a product without brand, belonging to a category without parent and no variations

   var _ra = _ra || {};

   _ra.sendProductInfo = {
       "id": 244,
       "name": "Full HD Sample TV",
       "url": "http://site.com/tv/full-hd-sample-tv",
       "img": "http://site.com/images/main-image-full-hd-sample-tv",
       "price": 1899.90,
       "promo": 1599.90,
       "brand": false,
       "category": [{
           "id": 44,
           "name": "TVs",
           "parent": false
       }],
       inventory: {
           "variations": false,
           "stock": true
       }
   };

   if (_ra.ready !== undefined) {
       _ra.sendProduct(_ra.sendProductInfo);
   }

sending a product without discount, with brand, categories and variations

    var _ra = _ra || {};

    _ra.sendProductInfo = {
        "id": 133,
        "name": "Men sneakers",
        "url": "http://site.com/tv/men-sneakers",
        "img": "http://site.com/images/main-image-men-sneakers",
        "price": 125.90,
        "promo": 0,
        "brand": {
            "id": 88,
            "name": "Sneakers Brand Name"
        },
        "category": [
            {
                "id": 75,
                "name": "Men footwear",
                "parent": false,
                "breadcrumb": []
            },
            {
                "id": 22,
                "name": "Sport sneakers",
                "parent": 21,
                "breadcrumb": [
                    {"id": 21, "name": "Sneakers", "parent": 20},
                    {"id": 20, "name": "Shoes", "parent": false}
                ]
            }
        ],
        "inventory": {
            "variations": true,
            "stock": {
                "42-B": true,
                "42-W": false,
                "43-B": true,
                "43-W": true
            }
        }
    };

    if (_ra.ready !== undefined) {
        _ra.sendProduct(_ra.sendProductInfo);
    }