Skip to content

Latest commit

 

History

History
71 lines (43 loc) · 1.44 KB

tracker.md

File metadata and controls

71 lines (43 loc) · 1.44 KB

Tracker API Reference

This reference documents all methods available in the Tracker API and explains in detail how these methods work.

track

This method records actions your users perform on your application.

For a list of available events, see the event reference.

Signature

The track method has the following signature:

croct.tracker.track(event: string, payload: EventPayload): Promise<Event>

The return is a Promise that resolves to the tracked event after successful transmission.

Code Sample

Here's a minimal example showing how track an event:

croct.tracker.track('goalCompleted', {goalId: 'newsletter-sign-up'});

enable

This method enables automatic event tracking.

Signature

The enable method has the following signature:

croct.tracker.enable(): void

Code Sample

Here's an example showing how to enable automatic event tracking:

croct.tracker.enable();

disable

This method disables automatic event tracking.

💡️ Hint
You can still track events by calling the track method even with automatic event tracking disabled.

Signature

The disable method has the following signature:

croct.tracker.disable(): void

Code Sample

Here's an example showing how to disable automatic event tracking:

croct.tracker.disable();