Use FlurryAgent.onEvent(String eventId, Map parameters)

后端 未结 2 1131
伪装坚强ぢ
伪装坚强ぢ 2021-02-07 23:10

Please anybody tell how to use

FlurryAgent.onEvent(String eventId, Map parameters)

in an android activity to track events

2条回答
  •  离开以前
    2021-02-08 00:12

    The simplest use of onEvent is without parameters.

    Let's say we're writing a game and you want to track how many people start the game and how many complete it. You would then have:

    FlurryAgent.onEvent("Started game");
    

    and

    FlurryAgent.onEvent("Won game");
    

    at appropriate points in your code.

    If you want to know more information about the state of the application when an event occurred, you can add parameters to track additional information like this:

    HashMap parameters = new HashMap();
    parameters.put("Final score", String.valueOf(score));
    parameters.put("Time taken", String.valueOf(secondsElapsed));
    FlurryAgent.onEvent("Won game", parameters);
    

    You can have up to 100 different event names, each with up to 10 parameters whose names and values are up to 255 characters long.

    Notice you don't specify your Flurry ID when calling onEvent. Flurry derives the ID from the current session, so calls to onEvent must be made somewhere between calls to onStartSession and onEndSession - but if you follow their guidelines and put these in your Activity's onStart and onStop then you don't have to worry about that.

提交回复
热议问题