Screen Tracking
For screen navigation in React Native, refer to the following React Native developer documentation.
React Native uses a single Activity/ViewController structure by default, making automatic screen information collection difficult.
To properly collect $page_view and $engagement events, you must directly call the setCurrentScreen method every time the screen changes.
setCurrentScreen
This feature is supported in React Native SDK version 3.30.0 and above.
Track screens using the setCurrentScreen(screen) method.
The minimum tracking time unit for screen tracking is 1 second.
The
$engagementfor pages changed within 1 second is not measured.
name
string
Required
The name of the current screen.
screenClass
string
Required
If you do not need a separate class name, enter the same value as name.
Screen tracking for the same screen is not possible.
If setCurrentScreen is called with the same Screen (where both name and screenClass are identical) as the previous screen, it is recognized as no screen transition and nothing happens.
$page_viewand$engagementare not called.
Example
Property
The Hackle SDK supports adding properties to Event objects.
The maximum number of properties that can be added to an event object is 64.
Property Key (key)
string
Character limit is 128 characters.
Case-insensitive. For example, amount and AMOUNT are recognized as the same key.
Property Value (value)
boolean, string, number, array
For string type, character limit is 1024 characters.
For number type, a maximum of 15 integer digits and 6 decimal places are supported.
Example
Disabling automaticScreenTracking
By default, automaticScreenTracking is enabled in the SDK. If you do not want automatic screen information collection at the Activity/ViewController level, you must disable automaticScreenTracking.
You can configure automaticScreenTracking when initializing the SDK.
If you manually collect screen information via setCurrentScreen while automaticScreenTracking is enabled, $page_view and $engagement may be over-collected or collected with unintended properties.
When manually collecting screen information, it is recommended to disable automaticScreenTracking.
Example
Last updated