General Implementation of Retargeting for Other eCommerce Platforms

You don`t need extensions to start using Retargeting. If your e-commerce platform is not yet supported by an extension, our General Documentation will help you get started.

  • JavaScript Tracking Code

    In order for Retargeting to record the necessary events from your site, you have to insert the following JavaScript code right before the closing of <head> tag.

    To use Retargeting you need the Tracking API Key from your Retargeting account. The Tracking API Key is automatically generated on account registration.

    The add_to_cart_button_id and price_label_id parameters are needed for the mouse over add to cart respectively mouse over product price events which are executed on the product page when a user moves the cursor over the add to cart button and respectively product price element.

    This code is loaded asynchronous, which means it won't slow down in any way the page's load time and it will work independently from your application.

  • setEmail Function

    This function needs to be called each time a guest registers, logs in or fills in the email address in a form on the website (e.g. Contact or Newsletter Form).

    setEmail Function Parameters

    email [required][text]: guest email address

    name [optional][text]: guest name

    phone [optional][text]: guest phone number

    city [optional][text]: guest town

    sex [optional][numeric:0/1]: guest sex – This parameter is numeric and has two possible values: 0 – woman and 1 – man

    birthday [optional][text]: guest birthday in format DD-MM-YYYY

    callback_function[optional][function]: with this parameter you can define a function that will be executed after setEmail's behaviour is finished.

    setEmail Function Parameters

  • sendCategory Function

    This function must be called when a visitor lands on a category page.

    sendCategory Function Parameters

    id [required][numeric/text]: category id

    name [required][text]: category name

    parent [required][numeric/text/false]: parent category id (category's parent id). If the category doesn't have a parent category, send false value

    breadcrumb [required][array]: array containing all the parent categories of the sent category (in this array you must not add the main category). If the category has no parent category then send an empty array.

    Each parent category from the breadcrumb is sent as an object and contains the following properties:

    • breadcrumb[0].id [required][numeric/text]: category id
    • breadcrumb[0].name [required][text]: category name
    • breadcrumb[0].parent [required][numeric/text/false]: parent id category. If there is no parent category then send false value.

    callback_function [optional][function]: with this parameter you can define a function that will be executed after sendCategory's behaviour is finished.

    sendCategory Function Examples

  • sendBrand Function

    This function must be called every time a visitor lands on a producer/brand page. In this case, the brand page is the page where the brand details are listed, or the page that lists the products belonging to that particular brand.

    sendBrand Function Parameters

    id [required][numeric/text]: brand id

    name [required][text]: brand name

    callback_function [optional][function]: with this parameter you can define a function that will be executed after sendBrand's behaviour is finished.

    sendBrand Function

  • sendProduct Function

    This function must be called every time a visitor lands on a product page (page showing the details of a product).

    sendProduct Function Parameters

    id [required][numeric/text]: product id

    name [required][text]: product name

    url [required][text]: product page

    img [required][text]: source (src) of main product image (URL of the image)

    price [required][numeric]: product price. If the product is on promotion (price is reduced) then this parameter gets the value of the price before the promotion was applied to the product (old price).

    promo [optional][numeric]: promotional price (new price). When the product isn’t on promotion (no reduced price), send value 0.

    brand [optional][object/false]: 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:

    • brand.id [required][numeric/text]: brand ID
    • brand.name [required][text]: brand name

    category [required][object]: details about product’s category

    The object containing brand details, has the following properties:

    • category.id [required][numeric/text]: category ID
    • category.name [required][text]: category name
    • category.parent [required][numeric/text/false]: parent category id (parent category which belongs directly to the product category, which in this case is a subcategory). If there isn’t any parent category, send false value.

    category.breadcrumb [required][array]: 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 sent false), send an empty array.

    Each parent category of the breadcrumb is sent as object and contains the following properties:

    • breadcrumb[0].id [required][numeric/text]: category ID
    • breadcrumb[0].name [required][text]: category name
    • breadcrumb[0].parent [required][numeric/text/false]: parent id category. If there is no parent category send false value.

    inventory [required][object]: details about product’s stock.

    inventory.variations [required][bool]: determine if the product has variations.

    inventory.stock [required][array|bool]: when the product doesn't have variations the value must be bool, otherwise must be an array of variation-stock pairs, where the stock values must be bool.

    callback_function [optional][function]: with this parameter you can define a function that will be executed after sendProduct's behaviour is finished.

    sendProduct Function Examples

  • addToCart Function

    This function must be called every time a product is added to cart.

    If you redirect to another page (e.g. the checkout page) right after the user added the product to cart, your store's add to cart function must be set as the callback function for our addToCart function, so it can execute right after the data has been sent to Retargeting (see the examples of the addToCart function).

    If add to cart is possible in other pages too, other than in the product page, you must first call the sendProduct function (for the product that will be added to cart) right before you call the addToCart function (see the examples of the addToCart function).

    In the following paragraphs of the addToCart function, we will talk about "variations" of the products. Variation of a product is the product's properties group the user has to choose when he is willing to add a product to cart: color, size, capacity, etc. For example, an online fashion store can set a system based on color and size variations: "Y-32" (yellow color and size 32), "R-XS" (red color and size XS), "M" (size M) etc.

    addToCart Function Parameters

    id [required][numeric/text]: product id

    quantity [required][numeric/text]: product quantity

    variation [required][object/false]: object with details about the chosen variation for the product added to cart. If the product does not have variations send false value

    The object containing the details of the chosen variation has the following properties:

    • variation.code [required][text]: unique combination of properties that form the variation of product, separated by dash (-). It is mandatory to use a simple dash (-) to separate the options of variation.
    • variation.stock [required][bool]: false - out of stock, true - in stock
    • variation.details [required][object]: object that contains details about each variation option.

    Variation details object contains an array of variation properties defined through the code used in the variation code object, and each property is an object containing the following properties:

    • variation.details.variation_code_option.category_name [required][text]: name of the category of the property
    • variation.details.variation_code_option.category [required][numeric/text]: unique token or unique id of the category of the property
    • variation.details.variation_code_option.value [required][text]: full name/value of the variation property (what the user selected)

    callback_function [optional][function]: with this parameter you can define a function that will be executed after addToCart's behaviour is finished.

    addToCart Function Examples

  • removeFromCart Function

    This function must be called every time a product is removed to cart.

    In the following paragraphs of the removeFromCart function, we will talk about "variations" of the products. Variation of a product is the product's properties group the user has to choose when he is willing to remove a product from cart: color, size, capacity, etc. For example, an online fashion store can set a system based on color and size variations: "Y-32" (yellow color and size 32), "R-XS" (red color and size XS), "M" (size M) etc.

    removeFromCart function parameters

    id [required][numeric/text]: product id

    variation [required][object/false]: object with details about the chosen variation for the product added to cart. If the product does not have variations send false value

    The object containing the details of the chosen variation has the following properties:

    • variation.code [required][text]: unique combination of properties that form the variation of product, separated by dash (-). It is mandatory to use a simple dash (-) to separate the options of variation.
    • variation.stock [required][bool]: false - out of stock, true - in stock
    • variation.details [required][object]: object that contains details about each variation option.

    Variation details object contains an array of variation properties defined through the code used in the variation code object, and each property is an object containing the following properties:

    • variation.details.variation_code_option.category_name [required][text]: name of the category of the property
    • variation.details.variation_code_option.category [required][numeric/text]: unique token or unique id of the category of the property
    • variation.details.variation_code_option.value [required][text]: full name/value of the variation property (what the user selected)

    callback_function [optional][function]: with this parameter you can define a function that will be executed after addToCart's behaviour is finished.

    removeFromCart Function Examples

  • setVariation Function

    This function must be called every time when a product variation is selected. It can be seen that the parameters are the same as the ones within the addToCart function.

    If the add to cart event is possible in other pages than the product page (implicitly the selection of variation), you must first call the sendProduct function for the product that is being added to cart.

    removeFromCart function parameters

    id [required][numeric/text]: product id

    variation [required][object/false]: object with details about the chosen variation for the product added to cart. If the product does not have variations send false value

    The object containing the details of the chosen variation has the following properties:

    • variation.code [required][text]: unique combination of properties that form the variation of product, separated by dash (-). It is mandatory to use a simple dash (-) to separate the options of variation.
    • variation.stock [required][bool]: false - out of stock, true - in stock
    • variation.details [required][object]: object that contains details about each variation option.

    Variation details object contains an array of variation properties defined through the code used in the variation code object, and each property is an object containing the following properties:

    • variation.details.variation_code_option.category_name [required][text]: name of the category of the property
    • variation.details.variation_code_option.category [required][numeric/text]: unique token or unique id of the category of the property
    • variation.details.variation_code_option.value [required][text]: full name/value of the variation property (what the user selected)
    • variation.details.variation_stock_option.stock [required][numeric]: if variation is in stock then send the value of 1. When the variation is not in stock send the value of 0.

    callback_function [optional][function]: with this parameter you can define a function that will be executed after addToCart's behaviour is finished.

    setVariation Function Example

  • addToWishlist Function

    This function must be called every time a product is added to a wishlist. If add to wishlist can be done in pages other than product page, the sendProduct function must be called prior to the calling of the addToWishlist function.

    addToWishlist function parameters

    id [required][numeric/text]: id of the product added to a wishlist

    callback_function [optional][function]: with this parameter you can define a function that will be executed after addToWishlist's behaviour is finished.

    addToWishlist Function Examples

  • clickImage Function

    This function must be called every time a visitor opens or clicks the main image of the product in the product page.

    clickImage function parameters

    id [required][numeric/text]: id of the product the picture belongs to

    callback_function [optional][function]: with this parameter you can define a function that will be executed after clickImage's behaviour is finished.

    clcikImage Function Examples

  • commentOnProduct Function

    This function must be called every time a visitor submits a product comment or review.

    commentOnProduct function parameters

    id [required][numeric/text]: id of the product for which the comment is added

    callback_function [optional][function]: with this parameter you can define a function that will be executed after commentOnProduct's behaviour is finished.

    commentOnProduct Function Examples

  • sendSearchTerm Function

    This function must be called every time a visitor reaches the page displaying the results of the search.

    sendSearchTerm function parameters

    term [required][text]: the searched term

    callback_function [optional][function]: with this parameter you can define a function that will be executed after sendSearchTerm's behaviour is finished.

    sendSearchTerm Function Examples

  • likeFacebook Function

    This function must be called every time a visitor likes (Facebook Like) a product while he is on that specific product's page.

    likeFacebook function parameters

    id [required][numeric/text]: the id of the liked product

    callback_function [optional][function]: with this parameter you can define a function that will be executed after likeFacebook's behaviour is finished.

    likeFacebook Function Examples

  • saveOrder Function

    This function must be called whenever an order is successfully registered.

    For any payment method, the function saveOrder must always be called on the Thank You page (the page where the user is informed that the order was registered). If there is no Thank You page, saveOrder function must be called after the order is successfully stored in the database.

    For example, for online payment methods, the saveOrder function must be called after the response from the payment processor is received and the answer is positive (not error or fail). In this case it means the order is successfully registered (was paid). The saveOrder function must be called on the Thank You page, when the whole registration process of the order is over.

    saveOrder function parameters

    order_no [required][numeric/text]: unique number of the order recorded

    lastname [optional][text]: name of the buyer

    firstname [optional][text]: buyer surname

    email [required][text]: e-mail adress of the buyer

    phone [optional][text]: phone number of the buyer

    state [optional][text]: district adress

    city [optional][text]: city adress

    address [optional][text]: buyer address

    birthday [optional][text]: buyer birthday in format dd-mm-yyyy

    discount [optional][numeric/0]: the amount/value by which the total amount was reduced. Note that we are not talking about the discount value (e.g. 10%), but the money amount (e.g. 5$ discount for a 100$ order). If there is no discount applied on the order, send value 0.

    discount_code [optional][text]: the discount code used when placing the order. If no discount code was used send a empty String (no character string "").

    shipping [optional][numeric/0]: value/amount paid for the shipping (shipping fee). If there is no shipping charge, send value 0.

    rebates [optional][numeric/0]: value/amount paid for the rebates. If there is no rebates charge, send value 0.

    fees [optional][numeric/0]: value/amount paid for the fees. If there is no fees charge, send value 0.

    total [required][numeric/0]: amount/total amount of payment for the order sent. Note that this is the total amount the buyer actually paid, the amount obtained after applying any discount and/or shipping fee.

    Products ordered are contained in the second parameter of the function, which is an Array. Details for each product are added in the Array through an object that has the following properties:

    • products[0].id [required][numeric/text]: product id
    • products[0].quantity [required][numeric]: quantity ordered
    • products[0].price [[required][numeric]: unit price of the product (per piece)
    • products[0].variation_code [required][text]: variation code of sent product – for variation code format and other details see variations from the addToCart functions and setVariation. If the product does not have variation please send a empty String (no character string "")

    callback_function [optional][function]: with this parameter you can define a function that will be executed after saveOrder's behaviour is finished.

    saveOrder Function Examples

  • visitHomePage Function

    This function must be called every time a visitor visits the home page of the website.

    visitHomePage Function Parameters

    callback_function [optional][function]: with this parameter you can define a function that will be executed after visitHomePage's behaviour is finished.

    visitHomePage Function Examples

  • visitHelpPage Function

    This function must be called every time a visitor visits one of the Help Pages of the site (e.g. How to order, FAQ, How do I get the products)

    visitHelpPage function parameters

    callback_function [optional][function]: with this parameter you can define a function that will be executed after visitHelpPage's behaviour is finished.

    visitHelpPage Function Examples

  • pageNotFound Function

    This function must be called every time a visitor reaches the 404 page of the website.

    pageNotFound function parameters

    callback_function [optional][function]: with this parameter you can define a function that will be executed after pageNotFound's behaviour is finished.

    pageNotFound Function Examples

  • checkoutIds Function

    This function must be called every time a visitor reaches the page where he can add the discount code - checkout/cart page.

    checkoutIds function parameters

    This function takes an array as a parameter, containing all the IDs of the products that the visitor intends to purchase (IDs of all the products from the shopping cart).

    product_id [required][numeric/text]: product id

    checkoutIds Function Examples

  • setCartUrl Function

    This function saves the url of the cart page.

    setCartUrl function parameters

    The function has only one parameter.

    url [required][text]: url of cart page

    setCartUrl Function Examples

  • Product stock feed

    In order for Retargeting to display only products available in stock you need to create a JSON product feed that returns some information about your products.

    Feed File Fields

    id [required][string]: product_id. It must match with the one sent via _ra.sendProductInfo.id

    price [required][double]: product_price

    promo [required][double]: product_promotional_price

    promo_price_end_date[optional][string]: promo_price_end_date. In case you cannot provide the end date of the promotional price, then set this attribute's value to null.

    inventory [required][object]

    inventory.variation [required][object]

    inventory.variation.variation_code_one [optional][boolean]

    inventory.variation.variation_code_two [optional][boolean]

    user_groups [optional][object/empty array]

    user_groups.silver [required][object]

    user_groups.silver.price [required][double]

    user_groups.silver.promo_price [required][double]

    user.groups.silver.promo_price_end_datee [optional][string]

    user_groups.gold [optional][double]

    user_groups.gold.price [required][double]

    user_groups.gold.promo_price [required][double]

    user.groups.gold.promo_price_end_datee [optional][string]

    product_availability [optional][string]: product_availability

    Feed File

  • REST API

    The REST API gives programmatic access to write and read operations over Retargeting.Biz data.

    To use the REST API you need the REST API KEY from your Retargeting account. The API KEY is automatically generated on account registration.

    Retargeting REST API Client

    You can use the Retargeting REST API Client to implement the REST API on your application.

    PHP Client download: Retargeting REST API Client

  • REST API: discount/create

    Create a new discount code for Retargeting

    Resource URLs

    JSON https://retargeting.biz/api/1.0/discount/create.json

    Serial https://retargeting.biz/api/1.0/discount/create.serial

    Parameters

    discount_type [required][numeric]:

    "fixed" - fixed value

    "fixed" - fixed value

    "nil" - custom discount code without value (like "Free delivery")

    discount_value [required][numeric]: value of discount or the name of discount code if it is "nil"

    Request Example

    Response Example

  • REST API: discount/check

    Check a discount code on Retargeting.

    Resource URLs

    JSON: https://retargeting.biz/api/1.0/discount/check.json

    Serial:https://retargeting.biz/api/1.0/discount/check.serial

    Parameters

    discount_code [required][text]: discount code you want to check

    Request Example

    Response Example

  • REST API: order/save

    Push an order to Retargeting.

    Resource URLs

    JSON: https://retargeting.biz/api/1.0/order/save.json

    Serial:https://retargeting.biz/api/1.0/order/save.serial

    Parameters

    order_no[required][numeric/text]: unique number of the order recorded

    lastname [optional][text]: name of the buyer

    firstname [optional][text]: buyer surname

    email [optional][text]: e-mail adress of the buyer

    phone [optional][text]: phone number of the buyer

    state [optional][text]: district adress

    city [optional][text]: city adress

    adress [optional][text]: buyer address

    discount_code[optional][array]: an array of discount codes used when placing the order. If no discount code was used send a empty String (no character string "").

    discount [optional][numeric/0]: the amount/value by which the total amount was reduced. Note that we are not talking about the discount value (e.g. 10%), but the money amount (e.g. 5$ discount for a 100$ order). If there is no discount applied on the order, send value 0.

    shipping [optional][numeric/0]: value/amount paid for the shipping (shipping fee). If there is no shipping charge, send value 0.

    rebates [optional][numeric/0]: value/amount paid for the rebates. If there is no rebates charge, send value 0.

    fees [optional][numeric/0]: value/amount paid for the fees. If there is no fees charge, send value 0.

    total [required][numeric/0]: amount/total amount of payment for the order sent. Note that this is the total amount the buyer actually paid, the amount obtained after applying any discount and/or shipping fee.

    Products ordered are contained in the second parameter of the function, which is Array type. Details for each product are added in Array through an object that has the following properties:

    products[0].id [required][numeric/text]: product ID

    products[0].quantity [required][numeric]: quantity ordered

    products[0].price [[required][numeric]: unit price of the product (per piece)

    products[0].variation_code [required][text]: variation code of sent product – for variation code format and other details see variations addToCart functions and setVariation. If the product does not have variation will send a empty string (no character string "")

    Request Example

    Response Example

  • Recommendation Engine Setup Guide

    Retargeting Recommendation Engine is an advanced business intelligence platform, powered by Artificial Intelligence, that helps online shops provide completely personalized decision-making support, by studying the behaviour of their users.

    The customization areas are the following:

    • Home Page
    • Category Page
    • Product Page
    • Checkout Page
    • Thank You Page
    • Out Of Stock Page
    • Search Page
    • 404 Page

    In order to display the products on your website, you must set a specific tag in the HTML of every type of page: