The Adjust Web SDK enables you to record attribution, events, and more in your web app. This guide shows you how to integrate the Adjust SDK with your app.
To get started, you need to add the SDK to your web app. The Adjust SDK works in both CommonJS and AMD (Asynchronous Module Definition) environments and can be accessed through a global
Adjust namespace when loaded through a CDN (Content Delivery Network).
When loading the SDK through a CDN, you should use a minified version for production builds. You can specify a version by adding it to the CDN target like this:
https://cdn.adjust.com/adjust-5.6.0.min.js. You can get the latest version by targeting the
adjust-latest package like this:
https://cdn.adjust.com/adjust-latest.min.js. This package updates automatically so you don't need to change the target file.
To load the SDK through a CDN, add the following snippet between your web app's
The Adjust SDK loads on each page and initates once per page load.
If you want to use Subresource Integrity checks to mitigate against Cross-Site Scripting (XSS) attacks, you can validate the package before running it by using the following call:
The Adjust SDK is also available on npm. To add the package to your project, use your preferred package manager:
2. Initialize the SDK
Once you've installed the SDK, you need to initialize it. To do this, call the
initSdk method. This method takes a number of parameters that customize how the SDK works in your app.
You must add the following arguments to your
initSdk call to initialize the SDK:
appToken: Your Adjust app token.
environment: The environment your app is running in. Set this to
sandboxto test your app locally.
To further customize your Adjust SDK setup, check out the guides in the configuration features section.