Debugger

 

Foreword

If you wish to check your tagging, a debugger is available in the SDK for consulting the hits and events generated.

The AT Internet debugger is not usable with JAR.

 

Initialisation (>= 2.2.2)

In the new version of the AT Internet Debugger, there is an additional prerequisite. You need to add a new permission in the AndroidManifest.xml file

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

Then just add the following code to the onCreate method of your Activity:

package com.atinternet.atinternetdemo;

import android.app.Activity;
import android.os.Bundle;

import com.atinternet.tracker.ATInternet;
import com.atinternet.tracker.Debugger;
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();
        Debugger.create(this, tracker);
    }
}

The debugger will then appear in the form of the AT Internet logo at the bottom right of your display. You can move this logo to avoid hindering use of your application.

However, as the application is not completely “killed”, the Debugger will be present. To remove it simply call the remove() method of the Debugger:

@Override
protected void onStop() {
    super.onStop();
    Debugger.remove();
}

This code can be added anywhere you need to destroy the Debugger.

 

Initialisation (< 2.2.2)

In the case of Fragments navigation, you must add the following code in the FragmentActivity which contains your application’s Fragments.

To display the debugger in one of the displays of your application, it is recommended to add the following code in the onCreate method of your Activity:

@Override
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Tracker tracker = ATInternet.getInstance().getDefaultTracker();
        Debugger.show(this, tracker);
}

 

For optimal use, please verify that in your AndroidManifest file, the activity on which you use the debugger does not show any configChanges attributes with the value screenSize.

The debugger will then appear in the form of the AT Internet logo at the bottom right of your display. You can move this logo to avoid hindering use of your application.

 

Utilisation

Since the version 2.1.1, a function is available to show/hide the Debugger :

Debugger.setViewerVisibility(true); // Show the debugger (default)
Debugger.setViewerVisibility(false); // Hide the debugger

Click on the AT Internet logo to make the events log appear:
eventviewer

The log enables you to see the different events sent or stored on the device. The icon at left determines whether the event was sent, stored, if an alert was triggered, or if an error occurred. The icon at right indicates the event category (screen tagging, gesture tagging, ad tagging…).

To see the details of the sent event, click on the displayed URL:

hitdetail

 

Viewing stored hits

If you have set up the SDK to store hits in case of loss of connection or in a permanent manner, the debugger will also allow you to view them. To do this, click the icon at the upper-left of the event log:

offlinehits

This window allows you to see the dates that hits were generated, as well as their URLs. The icon to the right indicates the hit category (screen tagging, gesture tagging, ad tagging…). The trash can icon at the right of the main top bar allows you to delete all stored hits.

To see the details of the stored hit, click on the displayed URL:

offlinehitdetail

Last update: 03/06/2020