Sending background hits


Utility of identification

Identification enables you to distinguish hits sent following direct usage of your application from hits sent in the background, automatically and independently of the user, with the help of AsyncTask for example.



The tracker possesses a context object, which possesses a property, backgroundMode. This is BackgroundMode-type enumeration.

By default, this property is set to Normal. In all cases of tagging automatic behaviours independent of the user, it should be set to Task.

To tag these types of operations, you must initialise a new tracker within your class in the case of a Service.

In the case of an AsyncTask, it is recommended to use a dedicated instance of the tracker. Should you wish to use a single instance of the tracker, please remember to reset the property to Normal at the end of AsyncTask execution.


Tagging examples

  1. Tagging a service
  2. Tagging an AsyncTask with a dedicated tracker
  3. Tagging an AsyncTask with a global tracker
Was this post helpful?
Last update: 05/04/2018