The `sa-sdk-javascript` is the official client-side SDK for SensorsData, a leading user behavior analytics platform. It facilitates comprehensive data collection from web applications, supporting various tracking methods including code-based, full-stack, and visual full-stack event tracking. The current stable version is 1.27.11, with frequent patch releases addressing bug fixes, performance improvements, and feature additions, as evidenced by its rapid iteration cadence. Key differentiators include its status as an open-source commercial SDK, robust support for diverse data collection strategies, and proven stability across a large customer base. The SDK is designed to help businesses implement data-driven strategies by providing reliable user behavior insights.
npm install sa-sdk-javascriptVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the SensorsData SDK, track a custom event, set user profile properties, and log in a user, showcasing fundamental data collection patterns.
Review the `CHANGELOG.md` for `v1.27.1` and subsequent versions carefully. Identify any removed plugins or APIs that your application relies on and update your code or configuration accordingly. Some integrations may require re-evaluation.
Before upgrading the SDK, always check the `CHANGELOG.md` and the official documentation for both the SDK and your SensorsData backend. Ensure your backend meets the minimum version requirements for new SDK features or changes to avoid data ingestion issues.
Be aware of this shift in priority when setting global properties. If you previously relied on `registerPage` properties having higher precedence, you may need to adjust your property registration logic or explicitly override with `track` call properties if `properties_priority` is set to 3 or higher.
If tracking data is not being received reliably, check for ad-blocker interference. For `v1.27.8` and above, consider configuring `custom_server_url` in the SDK initialization options. Note that this functionality typically requires a customized SensorsData backend instance to process data from the alternative URL.
For versions prior to 1.27.8, ensure that any parameters or keywords for visualization tools are placed correctly in the URL, typically before the hash fragment. Version 1.27.8 includes a fix addressing this specific issue, improving compatibility with hash-mode URLs.
If using a script tag, ensure it's loaded before any `sensorsdata` calls. If using modules, verify the `import sensorsdata from 'sa-sdk-javascript';` statement is present and executed correctly before usage.
Confirm that you are importing the default export `sensorsdata` directly (e.g., `import sensorsdata from 'sa-sdk-javascript';`). Ensure no other variables are shadowing the `sensorsdata` identifier and that the SDK's main instance is correctly loaded.
Verify the `serverUrl` and `project` in your SDK initialization are correct. Check the browser's network tab for failed requests to your `serverUrl`. Enable `show_log: true` in your SDK configuration for detailed client-side debugging logs. Consider implementing `custom_server_url` if ad-blockers are suspected (requires backend support).
No dependency data recorded yet.