When an interesting event occurs in your Jpre-BlackBerry 10 application, tag it using
these instructions.
You may want to collect additional data about some events, such as how many lives a
player has or the last action a user took before clicking on an advertisement. Collect
this additional data with the second form of tagEvent, which takes a
dictionary of key/value pairs, or attributes, along with the event name.
-
Tag a single event with no attributes by adding the following code, where
USER_CHOICE is a string describing the event.
public static final String USER_CHOICE_YES = "CHOICE_YES";
public static final String USER_CHOICE_NO = "CHOICE_NO";
public void someFunctionInsideAScreen()
{
boolean result = ProvideUserWithChoice();
if(result == true)
((AppClassName)UiApplication.getUiApplication()).
getLocalyticsSession().tagEvent(USER_CHOICE_YES);
else
((AppClassName)UiApplication.getUiApplication()).
getLocalyticsSession().tagEvent(USER_CHOICE_NO);
}
-
If you want to add attributes, modify the tag to include a dictionary of
key/value pairs.
private final static String PLAYER_LEVEL = "Player level";
HashTable values = new HashTable ();
values.put(PLAYER_LEVEL, String.valueOf(this.playerLevel));
localyticsSession.tagEvent(MyApp.TAG_RESET_GAME, values);