-
Notifications
You must be signed in to change notification settings - Fork 0
Tracker initialisation 7fd358
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.
To be able to use AT Internet’s SDK, it is NECESSARY to add the following authorisations in your AndroidManifest file, just before tag:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Be careful, the same instance of Tracker must not be shared in a concurrent programming,
otherwise the application will crash. The SDK code is not thread-safe, so it is necessary to use a different instance of Tracker per thread.
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
package com.atinternet.atinternetdemo;
import android.app.Activity;
import android.os.Bundle;
import com.atinternet.tracker.ATInternet;
import com.atinternet.tracker.Tracker;
public class MainActivity extends Activity {
private Tracker tracker;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tracker = ATInternet.getInstance().getDefaultTracker();
}
}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.
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:
private Tracker tracker;
private Tracker audioTracker;
private Tracker cartTracker;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tracker = ATInternet.getInstance().getDefaultTracker();
audioTracker = ATInternet.getInstance().getTracker("audioTracker");
cartTracker = ATInternet.getInstance().getTracker("cartTracker");
}In the above example, three tracker instances are created:
- defaultTracker: instance by default
- audioTracker: a tracker used to tag your audio streams
- 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.
Last update: 26/02/2019
-
Data API
- Data flow
- Advice optimizations data flow
- Error codes data flow
- Faq data flow
- General information data flow
- Technical information data flow
- Reporting API v3
- Getting started
- Methods
- Parameters
- Technical information
- REST API
- Campaigns
- Custom variables
- Getting started rest
- Methods rest
- Response structure parameters rest
- Fixed periods
- Parameters compatibility
- Relative periods
- Structure of the response
- “code” parameter
- “columns” parameter
- “evo” parameter
- “filter” parameter
- “include” parameter
- “lng” parameter
- “max-results” parameter
- “page-num” parameter
- “period” parameter
- “period” parameter: “H” v. “He” & “MN” v. “MNe”
- “retention” parameter
- “segmentdesc” parameter
- “segment” parameter
- “sep” parameter
- “sort” parameter
- “space” parameter
- Technical specifications rest
- Data flow
-
Data collection
- Android
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Users
- Apple
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Users
- General
- Cddc renew staging process
- Changelog
- Craft your hit
- Encoded parameters
- Server side cookie management
- Supported taggings
- Tagging deletion
- Utilisation of dispatch sdks
- JavaScript
- Advanced features
- Campaigns
- Changelog
- Content
- Ecommerce
- Getting started
- Partners javascript
- Users
- Piano Analytics
- Event tagging piano analytics
- Getting started piano analytics
- Piano analytics tagging
- Feeding piano analytics with as2 tagging
- Tagging custom properties sdk
- Android