Developers » AS2 tagging » Android » Content » Gestures 2.3.0
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
- 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); }
- 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); }
- Tagging a button touch:
@Override public void onClick(View v) { tracker.Gestures().add("Say Hello Everybody").setLevel2(1).sendTouch(); }
Gesture class
Properties
Name | Type | Default value | Description |
---|---|---|---|
name | String | Empty string | Gets or sets the gesture 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.Touch | Gets or sets the action type |
level2 | Int | -1 | Gets or sets the level 2 ID |
CustomObjects | CustomObjects | null | Class enabling the addition of custom objects on your hits/td> |
Methods
Name | Return type | Description |
---|---|---|
sendTouch | void | Sends a hit indicating that a “clickable” element was touched |
sendNavigation | void | Sends a hit indicating that a navigational item was touched |
sendDownload | void | Sends a hit indicating that a download was triggered |
sendExit | void | Sends a hit indicating that the user changed the display or closed the application |
sendSearch | void | Sends a hit indicating that the user “clicked” on a search result item |
InternalSearch(String keywordLabel, int resultPageNumber) | InternalSearch | Adds internal search informations |