Screen events
User.com SDK can automatically tracks user activity across the app. It is related to your app lifecycle, e.g. orientation changes, open/close application, switching between activities(going through one to another mobile screen). You can also manually track Activities (if you don’t set
UserCom.Builder.trackAllActivities()
) and Fragments usingUserCom.getInstance().trackScreen()
function.- activity created
- activity started (with intent arguments)
- activity stopped
- fragment created
- fragment started (with arguments)
- fragment stopped
- Manually screen tracking
You can manually enable screen tracking for specific support Activity (AppCompatActivity, FragmentActivity, etc.) or Fragment. To do this invoke
trackScreen()
inonCreate()
. From this time lifecycle(created, started, stopped) will be tracked.
Changing screen namepublic class MainActivity extends FragmentActivity { @Override public void onCreate() { super.onCreate(); UserCom.getInstance().trackScreen(this); } }
To define custom screen name (screen name that will appear in request) annotate activity class with @ScreenName annotation and
name
argument.If you don’t provide @ScreenName annotation then default value for this fragment will be
SplashFragment.class.getSimpleName()
.
Track screen arguments@ScreenName(name = "main_activity") public class SplashFragment extends Fragment { … }
Use
@TrackArguments
annotation to start screen arguments tracking (keys and values). For Activities, it’ll be passed intents and for Fragments passed arguments. By default, all values will be sent. To specify which intent keys should be tracked, put them into annotation array:@TrackArguments(intents = {MainActivity.INTENT_KEY1, MainActivity.INTENT_KEY2}) public class MainActivity extends Activity { public static final String INTENT_KEY1 = "INTENT_KEY1"; public static final String INTENT_KEY2 = "INTENT_KEY2"; }
The following screen events are available to be sent: