-
Notifications
You must be signed in to change notification settings - Fork 2
Data Tracking
Valentin Mourot edited this page Aug 5, 2020
·
1 revision
ODE Mobile Framework includes a helper that exports a simple API to track data from the functional modules. For now, this helper is connected to Matomo and App Center.
Connect views ("screens") to the the trackers with just a simple HOC :
import withViewTracking from "../../infra/tracker/withViewTracking";
class MyScreenComponent extends React.PureComponent<IPropsType, IStateType> { /* ... */ }
export default withViewTracking("moduleName/path")(MyScreenComponent); // Specify the virtual path of your screen component
Note: Only track Screen Components, i.e. components that are a direct child of a Navigator.
Note: The virtual path you pass as a parameter to
withViewTracking()
must start with you functional module name as mentioned in itsconfig.ts
.
Track a user action with an event. Use event tracking where you cannot use withViewTracking()
.
import { Trackers } from "../../infra/tracker";
Trackers.trackEvent("Module Name", "ACTION NAME", (optional) "Element name", (optional) number value);
This API is inherited from Matomo's trackEvent function. Always specify "Module Name" and "ACTION NAME" (uppercased).