Developers » AS2 tagging » Android » Getting started » Operating principle
Operating principle
General principles
The AT Internet tag allows you to follow your users’ activity throughout your application’s lifecycle.
To help you, the tag makes available classes (helpers) enabling the quick implementation of tracking for different application events (screen loads, gestures, video plays…).
These helpers enable you to define or add different types of tagging and put them in a queue. This queue can be “emptied” by calling the dispatch method, available in the Tracker class.
The tracker is not compatible for use with competing accesses (thread-safety)
List of available classes
Name | Description |
---|---|
Screen | Class enabling the tagging of screens |
DynamicScreen | Class enabling the tagging of screens whose name can vary (e.g: news feed) |
Gesture | Class enabling the tagging of gestures |
Campaign (deprecated since 2.3.0, see Screens) | Class enabling the addition of campaign information on your screen hits |
Publisher | Class enabling the tagging of your ads |
SelfPromotion | Class enabling the tagging of your self-promotion campaigns |
Aisle (deprecated since 2.3.0, see Screens) | Class enabling the tagging of your aisles (in the case of SalesTracker tagging) |
Cart | Class enabling the tagging of your product cart (in the case of SalesTracker tagging) |
Order | Class enabling the tagging of your orders (in the case of SalesTracker tagging) |
Location (deprecated since 2.3.0, see Screens) | Class enabling the addition of geolocation information on your screen hits |
CustomObject | Class enabling the addition of custom objects on your hits |
CustomVar (deprecated since 2.3.0, see Screens) | Class enabling the addition of custom variables on your screen hits |
IdentifiedVisitor | Class enabling the management of user identification |
InternalSearch (deprecated since 2.3.0, see Screens et Gestures) | Class enabling the tagging of your internal search engine |
NuggAd | Class enabling the addition of information from our partner NuggAd in your hits |
TVTracking | Class enabling the addition of TV Tracking information in your hits |
MediaPlayer | Class enabling the tagging of your audio and video feed |
Product | Class enabling the tagging of your products |
CustomTreeStructure (deprecated since 2.3.0, see Screens) | Class enabling the tagging of your custom tree |
Advanced tagging
Aside from using helpers, it is also possible to “manually” tag your application via the setParam method of the Tracker.
The setParam method allows you to add a parameter that will be sent on the next hit or on all following hits (volatile or persistent).
This method can take as a parameter the object ParamOption allowing for definition of the following information:
- relativePosition: Parameter’s position in the hit with regards to another parameter
- relativeParameterKey: Relative parameter key
- append: Allows concatenation of several values in the same variable
- separator: In the case of a table-type variable, defines the separator shown in the URL. When the append option is used, the separator will be used to separate the concatenated values.
- encode: Allows encoding of the variable’s value (true by default)
- persistent: Indicates if the variable must be present in all hits, or only in the following hit..
In order to send the defined variables, you must then call the Tracker‘s dispatch method.
Advanced tagging example
- Tagging a screen:
@Override protected void onResume() { super.onResume(); // Set screen name ATInternet.getInstance().getDefaultTracker().setParam("p", "Home"); // Set level 2 ID for screen ParamOption s2ParamOption = new ParamOption().setPersistent(true); ATInternet.getInstance().getDefaultTracker().setParam("s2", 1, s2ParamOption); // Send hit ATInternet.getInstance().getDefaultTracker().dispatch(); }
- Sending a hit with a custom object:
The hit will be considered as screen tagging
@Override protected void onResume() { super.onResume(); HashMap<String, String> myCustomObject = new HashMap<String, String>(); myCustomObject.put("myLanguage", "fr"); myCustomObject.put("myDevice", "Samsung Galaxy S6"); ATInternet.getInstance().getDefaultTracker().setParam("stc", myCustomObject).dispatch(); }
Default variables
When a hit is sent, the AT Internet tracker will automatically add variables to feed basic analyses:
Name | Description |
---|---|
vtag | Gets the SDK version |
ptag | Gets the platform where the SDK is integrated (e.g.: iOS, Android …) |
lng | Gets the user language |
mfmd | Gets the device make and model |
os | Gets the name and version of the device’s operating system |
apvr | Gets the application version |
apid | Gets the application package name |
hl | Gets the device’s local time |
r | Gets the device’s resolution |
car | Gets the device’s operator/carrier |
cn | Gets the connection type |
ts | Gets a timestamp indicating the time of hit creation |
idclient | Gets the user ID |
stc | Gets the JSON containing the application lifecycle data, crash information if applicable, or custom objects |