Skip to main content

Javascript (browserless)

Our JS browserless SDK aims at being integrated in any application running on Javascript and in an environment different from a browser.

The main difference from the standard JS SDK is that it doesn't call browser APIs (e.g: cookie storage, window dimensions, navigator.sendBeacon(), ...)

In this article, we will explain the specific implementation requirements. Tagging methods and most of the JS SDK features are the same.

Library installation

Install our NPM package:

npm install piano-analytics-js --save

Tracker initialization

You need to initialize a tracker instance in order to use the SDK.

Here is an example:

import {pianoAnalytics} from 'piano-analytics-js';
// for commonJS environment you can do the following
// const pianoAnalytics = require('piano-analytics-js').pianoAnalytics;

pianoAnalytics.setConfigurations({
site: 123456789,
collectDomain: "https://my.collect.domain",
});
pianoAnalytics.sendEvent("page.display", {
page: "Page label",
});

Unavailable properties

Since the SDK doesn't use browsers' APIs, here are the properties it can't retrieve automatically

  • idclient
  • device_screen_width
  • device_screen_height
  • device_display_width
  • device_display_height
  • browser_language
  • browser_language_local
  • previous_url
  • event_url_full
  • ch_ua