Gestures

 

Get off to a good start

Once your tag is initialised, you can start tagging gestures made by your users.

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

Declare a Tracker-type variable in your Activity

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();
    }
}
 

Tagging

To tag a gesture, the tracker exposes a gestures object that offers an add method.

By default, this method adds “touch”-type tagging. You can edit the event type via the action object of the Gesture object, returned by the add method.

The different actions are the following:

  • Touch: Sends a hit indicating that a “touch” has occurred
  • Navigate: Sends a hit indicating that a navigational item was touched
  • Download: Sends a hit indicating that a download was triggered
  • Exit: Sends a hit indicating that the user changed the display or closed the application
  • Search: Sends a hit indicating that the user “clicked” on a search result item

To send the defined information, you must manually call the method sendNavigation, sendExit, sendDownload, sendTouch or sendSearch of your Gesture object, or call the Tracker‘s dispatch method.

Please note, calling the methods sendNavigation, sendExit, sendDownload, sendTouch and sendSearch modifies the action property of the Gesture object.

 

Tagging examples

  1. Tagging a navigational button:
    @Override
    public void onClick(View v) {
            tracker.Gestures().add("Go to product detail").sendNavigation();
            Intent intent = new Intent(MainActivity.this, SecondActivity.class);
            startActivity(intent);
    }
  2. Tagging a navigational button with chapters:
    @Override
    public void onClick(View v) {
            tracker.Gestures().add("Go to product detail", "Products", "Cart").sendNavigation();
            Intent intent = new Intent(MainActivity.this, SecondActivity.class);
            startActivity(intent);
    }
  3. Tagging a button touch:
    @Override
    public void onClick(View v) {
            tracker.Gestures().add("Say Hello Everybody").setLevel2(1).sendTouch();
    }
 

Gesture class

 

Properties

NameTypeDefault valueDescription
nameStringEmpty stringGets or sets the gesture name
chapter1StringnullGets or sets the first chapter
chapter2StringnullGets or sets the second chapter
chapter3StringnullGets or sets the third chapter
actionEnumAction.TouchGets or sets the action type
level2Int-1Gets or sets the level 2 ID
CustomObjectsCustomObjectsnullClass enabling the addition of custom objects on your hits/td>
 

Methods

NameReturn typeDescription
sendTouchvoidSends a hit indicating that a “clickable” element was touched
sendNavigationvoidSends a hit indicating that a navigational item was touched
sendDownloadvoidSends a hit indicating that a download was triggered
sendExitvoidSends a hit indicating that the user changed the display or closed the application
sendSearchvoidSends a hit indicating that the user “clicked” on a search result item
InternalSearch(String keywordLabel, int resultPageNumber)InternalSearchAdds internal search informations
 

Was this post helpful?

Last update: 05/04/2018