A simple JavaScript library for Cronitor Real User Monitoring.
Run the following command to install in your project:
npm install @cronitorio/cronitor-rum
You can now import, and use the client on your project.
import * as Cronitor from '@cronitorio/cronitor-rum';
// Load the Cronitor tracker once in your app
Cronitor.load('YOUR_CLIENT_KEY');
// This is how you record page views
Cronitor.track('Pageview');
// You can also trigger custom events
Cronitor.track('NewsletterSignup');You can set any configuration options as follows:
import * as Cronitor from '@cronitorio/cronitor-rum';
// Load the Cronitor tracker once in your app
Cronitor.load('YOUR_CLIENT_KEY', {
debug: true,
environment: "staging",
includeURLQueryParams: ["tab", "pageNum"]
});To exclude your own visits from being tracked, append ?cronitor_rum_disable to any page URL on your site:
https://yoursite.com?cronitor_rum_disable
This stores a flag in your browser's localStorage that prevents all subsequent tracking on that browser. The exclusion persists across sessions.
To re-enable tracking, visit any page with ?cronitor_rum_enable:
https://yoursite.com?cronitor_rum_enable
- Fix crash when using NPM import with
trackMode: "history"(#3). - Update CI to Node 18 and GitHub Actions v4.
- Bug fix. Bind sendBeacon to navigator.
- Rename package.
- Open source analytics script.
- Update types.
- Initial open source release.
If you discover any issue regarding security, please disclose the information responsibly by emailing us at support@cronitor.io. Do NOT create a Issue on the GitHub repo.
Please check for any existing issues before opening a new Issue. If you'd like to work on something, please open a new Issue describing what you'd like to do before submitting a Pull Request.
See LICENSE.