JavaScript & Frameworks
This guide is designed for developers integrating ScaleDynamics directly into modern JavaScript applications (such as React, Vue, Angular, or Vanilla JS modules).
Before beginning the integration, you must obtain your private data stream endpoint URL from your dedicated ScaleDynamics account team. This URL is unique to your report and must remain confidential. In the code snippets below, replace <PRIVATE_URL> with this exact endpoint.
Add the following code to your application's entry point. The module is loaded asynchronously, so your application never waits for it: sd is a promise that resolves to your SdMetrics instance once it is loaded. If the module cannot be loaded, the promise rejects.
const sd = import('https://cdn.scaledynamics.com/libs/1/sd-metrics.js')
.then(({ SdMetrics }) => new SdMetrics({
// Replace <PRIVATE_URL> with your private data stream endpoint URL
endpoint: '<PRIVATE_URL>',
}));
// use sd-metrics API, e.g. const bdp = await sd.then((metrics) => metrics.bdp.get());
// ...