Browser

Astrolytics

Table of Contents

  1. Getting Started

  2. Usage

  3. How to Contribute

Getting Started

To get started with Astrolytics, create an account at Astrolytics and grab the App ID, then use the SDK to start tracking events.

Installation

As NPM package (recommended)

or as browser script

we recommend using a specific version in case a non-backwards compatible change is introduced

Usage

Replace 'YOUR_APP_ID' with the unique ID of your app. You can get it here.

You can check examples with different frameworks here.

API

Astrolytics supports passing the following options as second argument to the Astrolytics.init() method:

Tracking

Track events with optional custom data

Error Tracking

Track errors with a name and the Error object.

By default Astrolytics will listen for window.onerror and window.onunhandledrejection events and send them to the API. If you want to disable this behaviour, you can set disableErrorReports to true:

User Identification

Identify a user by a unique ID and optionally set custom properties.

Page Tracking

Track page views with the page name and optional parameters. If the page name is not provided, the current window's pathname is used.

By default, Astrolytics will track any page change by polling the url every 50 ms. If you prefer to manually track page changes, set automaticPageTracking to false and call Astrolytics.page() on every page change.

Disabling Tracking

To disable tracking

Enabling Tracking

To enable tracking

Last updated