Skip to main content

API Specification

The Analytics framework offers three primary methods for both client-side and server-side operations: track, group, and identify.

Track

The track method enables you to record individual events, such as user actions like signing up, downloading an e-book, or adding items to a shopping cart.

Usage

To manually trigger a tracking event, use the following command:

dreamdata.track('Download e-book', {
bookName: 'How to use Dreamdata',
})

In this example, the event "Download e-book" is tracked with additional metadata specifying the book name.

Group

The group method allows you to associate the current user with a group, typically representing an organization or company.

Usage

To add group information, use the following command:

dreamdata.group('90577a70-57b2-4ce6-aa03-a9917a157fc2', {
companyName: 'Dreamdata',
})

Here, the user is associated with a group identified by the ID 90577a70-57b2-4ce6-aa03-a9917a157fc2, and additional information about the group (such as the company name) is provided.

In practice, this will most of the time be the company the user is associated to.

Identify

The identify method is used to add information about the current user, such as their user ID, email, or name.

Usage

To identify a user, use the following command:

dreamdata.identify('5c684fbb-b00e-4f27-8709-c21734fbc90d', {
email: 'friends@dreamdata.io',
})

In this example, the user is identified by the ID 5c684fbb-b00e-4f27-8709-c21734fbc90d, and their email is specified as additional information.