Upsight logo Back to top

Quick Start Guide

The Basics

This is a JavaScript SDK around Upsight Analytics's Data Collection API. It provides methods to make the API calls for all the different message types supported by Upsight.

Download SDK

To get started with the Upsight Analytics library, you will need to download the JavaScript SDK from the SDK Downloads page and include it in your project.

You will also need to instantiate and configure an instance of the Kontagent object.

// include the library
<script src="./kontagent_api.js"></script>


// configure and instantiate Kontagent object
var ktApi = new KontagentApi(ktApiKey);


Using the Library


Once you've got your Kontagent object instantiated and configured you can start using the library. Essentially, there are two types of methods provided in the library: tracking methods and helper methods.

Using the Library

Tracking Methods

The tracking methods should get called by your application whenever you need to report an event to Upsight Analytics. There is a tracking method available for every message type in the Kontagent Data Collection API. A few examples are:


ktApi.trackPageRequest('1234567890', {pageAddress : '/game.html'}, function() {
    // request has been successfully sent
    console.log('pageview tracked');

        subtype1 : 'user_action',
        subtype2 : 'game_played'
    function() {
        console.log('event tracked');


When events happen within your application, you should make the appropriate call to Upsight Analytics. We will then crunch and analyze this data in our systems and present them to you in your dashboard.

For a full list of the available tracking methods, refer to the JS SDK specification below.

Using the Library

Helper Methods

The library provides a few helper methods for common tasks. Currently the only ones available are:


var uTag = ktApi.genUniqueTrackingTag();

var shortUTag = ktApi.genShortUniqueTrackingTag();


These methods will help you generate the tracking tag parameters required to link certain messages together (for example: invite sent -> invite response -> application added).


If you are not instrumenting with the Upsight Analytics Facebook SDK and instead instrumenting with this wrapper, you may run into some issues. Please see our Facebook Best Practices page for troubleshooting tips.


If sending a request to HTTPS, set optionalParams.useHttps to TRUE in the constructor, just as would set useTestServer to true when using the test server.