You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Track views
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 its config.ts.
Track events
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).