Javascript

Setup

LAST EDIT May 04 2021

The code below shows how to install Stream's Analytics SDK:

Include the above code snippet in the <head></head> section of your page.

JavaScript is loaded asynchronously for optimal performance.

Using CommonJS Modules

Copied!

If you're using CommonJS modules, run the following command in your project directory:

After installing the package, require it in your app:

Client Setup

Copied!

The snippet below shows you how to initialize Stream's analytics client:

Bind the service in your application's manifest.xml:

Always specify the current user before sending events: