Support Home > Web SDK Integration > NodeJS Web SDK Integration

NodeJS Web SDK Integration

Feature Summary: The Kochava Web SDK is a javascript-based solution that provides marketers with Web Tracking capabilities. It can be integrated with a variety of web-based frameworks and can also be installed via NPM.

 

This document describes how to install the SDK using Node.js & NPM (Node Package Manager), which is not specific to any framework.

NOTE: This page describes a generic node integration with the SDK. If you are using a node JavaScript framework, like React, Vue, Angular etc, refer to the Integration documentation for the appropriate framework.


Integrating the SDK

Estimated Time to Complete
5 Minutes

(Release Notes)

 

Requirements:

  • NodeJS
  • NPM

Supported Platforms:

  • NodeJS

Data Privacy:

  • SDK Data Privacy and Safety

 

  1. As a prerequisite, ensure Node.js and the NPM CLI are set up and ready to use locally. See https://docs.npmjs.com/downloading-and-installing-node-js-and-npm for more information.
  2. Install the latest Kochava SDK version using one of the following CLI commands:
    Globally: npm install -g kochava Locally: npm install kochava Local as Dev Dependency: npm install -D kochava or npm install kochava --save-dev

 

For more information on installing packages from the CLI, see: https://docs.npmjs.com/cli/v6/commands/npm-install

 

Versioning:

The latest SDK version will be installed using the above commands, and we strongly recommend always installing the latest version. However, if you wish to install a specific version, the desired version should be appended to the CLI command. For example, to install SDK version 3.0.0 the CLI command might look like this: npm install kochava@3.0.0


Starting the SDK

The location of the start call can vary widely depending on how your Node project is set up and configured, but as a general rule, try to place this call in whatever context represents the start of your web page.

Once you have added the Kochava SDK to your project, the next step is to create and start the SDK class in code. Only your App GUID is required to start the SDK with the default settings, which is the case for typical integrations.

Kochava recommends starting the SDK as soon as the application starts, although this can be done later if needed. Starting the tracker as early as possible will ensure it is started before use, resulting in more accurate data/behavior.

 

Where your web page starts:

  1. Import the Kochava class.
  2. Create an instance of the Kochava class (we recommend calling it lower-case ‘kochava’).
  3. (Optional) Make any desired pre-start configuration calls (registerIdentityLink, disableAutoPage, useCookies etc).
  4. Call startWithAppGuid using a valid Kochava App GUID.
  5.  

     

 

SDK Waypoint: At this point basic integration is complete! Optional functionality is discussed below.

From here on, the SDK is integrated and ready, the following configuration calls are optional, and are only for special desired SDK behavior. The following code snippets should be placed at in the above snippet, at the comment labeled “Optional pre-start calls will go here”.

 

Disable Automatic Page Events:

Call this function with an argument of true to stop the SDK from automatically signaling a page event when the SDK starts.

 

Use Cookie Storage:

Call this function with an argument of true to drop the Cookie on the website to track a device across sub-domains.



Confirm the Integration

After integrating the SDK and adding the code to start the tracker, launch and run the app for at least 10 seconds or more. During this time the tracker will start and send an install payload to Kochava. To confirm integration was successful, visit the app’s Install Feed Validation page Apps & Assets > Install Feed Validation. On this page you should see one of two integration messages, indicating integration success or failure.

 

Integration Successful:

 Integration Success!

 

Along with this message you will also see a variety of data points associated with the device used for testing. At this point your integration is successful and you can proceed to the next step(s).

NOTE: It may take a few minutes for the first install to appear within the Install Feed Validation page. If you do not see this message immediately, you may simply need to wait a few minutes and check again.


Integration Not Complete:

 Integration Not Complete!

 

If you encounter this message, please review the integration steps, uninstall and reinstall the app, and check again.

 
 

 

Where to Go From Here:

Now that you have completed integration you are ready to utilize the many features offered by the Kochava SDK. Continue on to Using the SDK and choose a topic.

 
 

Last Modified: May 16, 2022 at 10:34 am