Tracker initialisation

 

Get off to a good start

Once the AT Internet library has been integrated with your project, you should initialise your tracker in order to tag your different views or actions.

The ATInternet class allows you to initialise one or several trackers, name them, and memorise them.

 

Prerequisite

To be able to use AT Internet’s SDK, it is NECESSARY to add the following authorisations in your AndroidManifest file, just before <application> tag:

 

Initialisation

 

Using a unique tracker for your application

If your application does not require the use of several trackers, the ATInternet class exposes a defaultTracker method that allows you to easily manage a tracker.

The tracker initialization must be done after the super.onCreate(savedInstanceState); line

Access to the defaultTracker object allows you to instantiate a tracker named defaultTracker and memorise its instance. When you call this object in the future, you will recover the same instance.

 

Using several trackers

If you need to manage several trackers, the ATInternet class enables you to instantiate, name, and memorise these different instances.

To initialise your different trackers, add the following code in the onCreate method of your Activity or onCreateView of your Fragment:

In the above example, three tracker instances are created:

  1. defaultTracker: instance by default
  2. audioTracker: a tracker used to tag your audio streams
  3. cartTracker: a tracker used to tag your product cart

When calling these properties/methods (e.g. in a Activity), you will recover these previously created instances.

Was this post helpful?
Yes
No
Last update: 30/01/2018