Browser
Last updated
# with npm
npm install astrolytics-browser
# or with yarn
yarn add astrolytics-browser<script src="https://cdn.jsdelivr.net/npm/astrolytics-browser/dist/bundle.iife.js"></script><script src="https://cdn.jsdelivr.net/npm/astrolytics-browser@<version>/dist/bundle.iife.js"></script>import Astrolytics from 'astrolytics-browser';
Astrolytics.init('YOUR_APP_ID');Astrolytics.init('APP_ID', {
endpoint: 'wss://app.astrolytics.io', // only option, we don't allow self hosting yet :(
disableInDev: true, // disable in development mode. We recommend not to call
// `init` method, as that will be more reliable.
debug: false, // if set to `true`, will log a bunch of things.
disableTracking: false, // will not track anything. You can also use `Astrolytics.disableTracking()`.
// note that some events will still be added to the queue, so if you call
// Astrolytics.enableTracking() again, they will be sent to the server.
automaticPageTracking: true, // will track all page changes.
reportInterval: 2 * 1000, // at which interval the events are sent to the server.
sessionTimeout: 60 * 30 * 1000, // time after which the session is ended
cutoff: 60 * 60 * 48 * 1000, // time after which event that were not sent yet are deleted
disableErrorReports: false, // wether to disable error tracking
})Astrolytics.track("click", { foo: 'bar' });Astrolytics.trackError(name, error);Astrolytics.init('APP_ID', { disableErrorReports: true })Astrolytics.identify('04f8846d-ecca-4a81-8740-f6428ceb7f7b', { firstName: 'Brendan', lastName: 'Eich' });Astrolytics.page('/about', { foo: 'baz' });Astrolytics.disableTracking();Astrolytics.enableTracking();