No description, website, or topics provided.
JavaScript CSS HTML
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Synerise SDK for JavaScript

The Synerise JavaScript SDK is designed to be simple to develop and allows you to easily integrate the SyneriseSDK software with your web application. For more information about Synerise visit the Synerise Website.

System requirements

  • You need to add the Synerise’s tracking codes into your website. You can find it in the Synerise Settings, in the Tracking code submenu. Alternatively, please sign up to your business profile in Synerise and open this location.

How to install the library

To start using the Synerise JavaScript SDK, just paste the following code into your web page inside the <head> and </head> tags.

        function onSyneriseLoad() {

        (function(s,y,n,e,r,i,se){s['SyneriseObjectNamespace']=r;s[r]=s[r]||[],s[r]._t=1*new Date(),
        s[r]._i=0,s[r]._l=i;var z=y.createElement(n),se=y.getElementsByTagName(n)[0];z.async=1;z.src=e;
        se.parentNode.insertBefore(z,se);z.onload=z.onreadystatechange=function(){var rdy=z.readyState;
        if(!rdy||/complete|loaded/.test(z.readyState)){s[i]();z.onload = null;z.onreadystatechange=null;}};
        })(window,document,'script','','SR', 'onSyneriseLoad');

The library provides a global variable named SR that can be used to send data to Synerise. You can its name in the last line of the presented code('SR').

Remember that the SP variable can be used, when the onSyneriseLoad function is loaded, which is realised automatically by the Synerise SDK.

Configuration and setup

To move to the next step of configuration, you have to create a business profile in Synerise. Learn how to do it here ( If your business profile has already been created and configurated, the unique API-key will be created. After that you will be able to copy the API-key, which is necessary to send request to the Synerise API.

In the previous step the onSyneriseLoad function was presented:

    function onSyneriseLoad() {

Make sure to fill in the YOUR_TRACKER_KEY parameter with your unique YOUR_TRACKER_KEY. You can get an Tracker-Key by logging in on

Using promises

A JavaScript promise represents the result of an asynchronous operation. Promises can be in one of three states: pending, fulfilled or rejected. To access a promise's fulfilled value or rejection reason, register your handler to the promise's Then method.

The JavaScript client library provides the Promises/A+-conformant interface. Using promises gives also you elegant error handling and easy chaining.

An example of a single request:

    SR.event.track('Add to favourites').then(function(response) {
      // Handle response
    }, function(reason) {
      // Handle error


    SR.event.track('Add to favourites').then(function(response) {
      // Handle response
    }).catch(function(reason) {
      // Handle error

Events tracking

If you want to inform Synerise about actions performed by users inside app, use the Synerise event manager SP.event and the track method.

    // Track an event

First parameter is an event name that you want track and second are optional parameters you want to have associated with this event

    // e.g. track "add product to favourites" event
    SR.event.track('Add to favourites', {
        'producName': 'iPhone 6',
        'productCategory': 'Smartphones'
    // e.g. track "choose point on map" event
    SR.event.track('Choose point on map', {
        'map': 'deliveryPoints',
        'points': 12

Identifying Users

Tracking codes allow the identification of the client and his relationship with the existing profile. All events generated by such client are associated with the profile of the identified person.

In the future you will be able to take full advantage of the Customer Identify key. This is the identification key, which is not assigned by Synerise. It allows additional client identification, and also to associate clients with external database (e.g. the list of your online shop clients) with clients saved in the Synerise data base.

Dynamic content

Synerise enables you to create and send rich dynamic content to clients who are browsing your website. This is a very powerful feature! You can use it to show personalized notifications, ads or whatever you want.

Go to the Dynamic contents menu to use it.

When the library will be initialized the JavaScript SDK will automatically check for a dynamic content. It’s available for the current client, it will be displayed immediately in the specified place. You can define where and when dynamic content will be presented.