Skip to content

Data Collection Custom Rules

Action

This document is used to carry the custom rules for Action automatic collection in the React Native SDK.

After enabling enableAutoTrackUserAction, the SDK will automatically collect click operations on components that have the onPress property. If you wish to perform some custom operations on top of automatic tracking, the SDK supports the following operations:

Customize the actionName for a component's click event

Set it via the accessibilityLabel property.

<Button
  title="Custom Action Name"
  accessibilityLabel="custom_action_name"
  onPress={() => {
    console.log('btn click');
  }}
/>

Do not collect click events for a specific component

Can be set by adding the ft-enable-track custom parameter with the value set to false.

<Button
  title="Action Click"
  ft-enable-track="false"
  onPress={() => {
    console.log('btn click');
  }}
/>

Add extra properties to a component's click event

Can be set by adding the ft-extra-property custom parameter, which requires the value to be a JSON string.

<Button
  title="Action Add Extra Properties"
  ft-extra-property='{"e_name": "John Doe", "e_age": 30, "e_city": "New York"}'
  onPress={() => {
    console.log('btn click');
  }}
/>