Android widgets can be tracked by using the same methods as your app. Widgets share the application context with your app, so hit order and visitor identification is preserved.
The following guidelines will help you track Android widgets:
Do not implement lifecycle metrics (
stopActivity) calls in the widget.
To track when a widget is added to the home screen, add a
trackEventcall to the
onEnabledmethod of the widget.
To track when the app is launched from a widget, add a
trackEventcall before you create the intent to launch your application.
To track the context of an action, you can define a
ContextDatavariable that provides the option to segment each action separately (for example,