Get off to a good start

Once your tag is initialised, you can start tagging your screens.

If you want to use variables, be sure to import ATInternet, Tracker and Screen classes in your Activity or Fragment.

Declare a Tracker-type variable in your Activity

package com.atinternet.atinternetdemo;

import android.os.Bundle;

import com.atinternet.tracker.ATInternet;
import com.atinternet.tracker.Tracker;

public class MainActivity extends Activity {

    private Tracker tracker;

    protected void onCreate(Bundle savedInstanceState) {
        tracker = ATInternet.getInstance().getDefaultTracker();

    protected void onResume() {


To tag a screen, the tracker exposes a screens object.

Two solutions are available to tag a screen:

  • Define one or several tagging and send the hit(s) at the desired moment
  • Send screen tagging directly

To do this, the screens object of the Tracker class offers an add method.
This method enables the addition of screen tagging which can be sent at the desired moment (e.g. onCreate, onResume…).

The add method sends back a Screen-type object. To send the defined information, you must manually call the sendView method of your Screen object, or call the Tracker’s dispatch method.

The method can take several different parameters:

  1. A character string to give a specific name
  2. A Context to retrieve the class name where tagging is done

Tagging examples

  1. Tagging a screen:
    protected void onResume() {
  2. Screen tagging with context:
    protected void onResume() {
  3. Tagging a screen with a level 2:
    protected void onResume() {
  4. Tagging a screen with chapters:
    protected void onResume() {
            tracker.Screens().add("Today News", "Home", "News").sendView();
  5. Screen tagging with addition of a custom object: In this example, the name of the screen is not entered because it is possible to put the name in the stc parameter in order to use it with DataManager.
    protected void onResume() {
            Screen s = tracker.Screens().add(this);
            s.CustomObjects().add(new HashMap<String, Object>() {{
                put("page", "Home");
  6. Tagging a screen with use of dispatcher:
    protected void onResume() {

Screen class



Name Type Default value Description
name String Empty string Gets or sets the screen name
chapter1 String null Gets or sets the first chapter
chapter2 String null Gets or sets the second chapter
chapter3 String null Gets or sets the third chapter
action Enum Action.View Gets or sets the action type
level2 Int -1 Gets or sets the level 2 ID
isBasketScreen Bool false Indicates that the screen displays the content of a cart (in the case where the SalesTracker option is used)
Publishers PublisherImpressions null Class enabling the tagging of your ads impressions
SelfPromotions SelfPromotionImpressions null Class enabling the tagging of your self-promotion impressions
CustomObjects CustomObjects null Class enabling the addition of custom objects on your hits
CustomVars CustomVars null Class enabling the addition of custom variables on your screen hits


Name Return type Description
sendView void Sends the screen hit
Aisle(int level1) Aisle Adds an aisle
Campaign(String campaignId) Campaign Adds a campaign
setCart(Cart cart) void Set a cart to the screen
Order(String orderId, double turnover) Order Adds an order
Location(double latitude, double longitude) Location Adds location informations
InternalSearch(String keywordLabel, int resultPageNumber) InternalSearch Adds internal search informations
CustomTreeStructure(int category1) CustomTreeStructure Adds a custom tree
Was this post helpful?
Last update: 13/03/2018