Analytics Tracking
Consult with the Treasure team to develop a data dictionary / taxonomy prior to telemetry instrumentation
Our analytics tracking system allows you to track custom client-side events and properties to better understand your users’ behavior. Integration is simple and requires only a few lines of code.
See the connect-react example application for the full end-to-end source code.
Usage
To use analytics please let us know and in a private channel we’ll provide you
the {DATA_PLATFORM_URL}
and the X-API-Key
header value to use.
The React TDK’s analytics API is built on top of the core TDK’s analytics API. By passing in additional options to the TreasureProvider
components, the useTreasure
hook will return allow you to use the trackCustomEvent
method to interact with Darkmatter API.
Provider with AnalyticsOptions
To use the React Analytics API, you will need to pass in an AnalyticsOptions
object to the TreasureProvider
component. These are the same parameters that you would pass to the core TDK’s AnalyticsManager
class.
Track events
Track a custom event with the trackCustomEvent
method exposed by the useTreasure
hook.
The trackCustomEvent
method accepts an AnalyticsEvent
object with the following properties:
Unlike the core TDK’s trackCustomEvent
method, the React TDK’s
trackCustomEvent
only requires a userId
or address
to be passed in if a
user hasn’t been logged in.