In-App Events Tracking Integration Guide

In-App Events Tracking Integration Guide
Syntax:
-
public static void trackEvent(Context context, String eventName, Map eventValues)
context use getApplicationContext()
eventName is any string to define the event name. You can find a list of recommended constant event names in Event Table below.
eventValues is a map of event parameters that comprise a rich event. You can find a list of recommended parameters in Event Table below.
List of Event Supported
E-commerce
Ticket
(Travel & Event)
Game
Branding/Content
Complete Registration
Complete Registration
Tutorial Completion
Complete Registration
Login
Login
Search
Complete Registration
Login
Search
Purchase
Add to wishlist
Content View
Level achieved
Add to cart
Reservation
Content View
Add Payment Info
Purchase
Share
Update
Push notification open
Achievement unlocked
Spent credit
Travel booking / Event Booking
Arena battle
Share
Guild Joined
Update
Push notification open
PVP
Login
Search
Content View
Share
Update
Update
Push notification open
Push notification open
Event String Constant
Syntax
Example JSON end result
LOGIN
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Map to track User who login into app
eventValue.put(AFInAppEventParameterName.SUCCESS,true);
“event_name”:”af_login”,
“event_value": {
"af_success":true
}
AppsFlyerLib.trackEvent(content,AFInAppEventType.LOGIN,eventValue);

This will generate an event of type “af_login” with the event values as in the
example
* Note:
SUCCESS: boolean – User login status (true/false)
COMPLETE_REGISTRATION
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Map to track User who login into app
eventValue.put(AFInAppEventParameterName.REGISTRATION_METHOD,”email”);
eventValue.put(AFInAppEventParameterName.CONTENT_ID,”[email protected]”);
“event_name”:”af_complete_registration”,
“event_value": {
"af_registration_method":”email”,
"af_content_id":”[email protected]”
}
AppsFlyerLib.trackEvent(content,AFInAppEventType.COMPLETE_REGISTRATION,eventV
alue);

This will generate an event of type “af_complete_registration” with the event
values as in the example
* Note:
REGISTRATION_METHOD: String – Method User use to Login (Email/Facebook/UserID…)
CONTENT_ID: String – Account user use(Email Address/Facebook ID/UserID…)
SEARCH
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Map to track User who search for content in app.
eventValue.put(AFInAppEventParameterName.CONTENT_TYPE,”Fahion”);
eventValue.put(AFInAppEventParameterName.SEARCH_STRING,”cotton blue shirt”);
eventValue.put(AFInAppEventParameterName.SUCCESS,true);
“event_name”:”af_search”,
“event_value": {
"af_content_type":”Fashion”,
"af_search_string": ”cotton blue shirt”,
"af_success":true
}
AppsFlyerLib.trackEvent(content,AFInAppEventType.SEARCH,eventValue);

This will generate an event of type “af_search” with the event values as in the
example
* Note:
CONTENT_TYPE: String – In which category user start searching
SEARCH_STRING: String – Value that user typed in search bar
SUCCESS: boolean – User search result (true if has results/false if no result)
CONTENT_VIEW
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Map to track User who view a single content in app
eventValue.put(AFInAppEventParameterName.PRICE,50);
eventValue.put(AFInAppEventParameterName.CONTENT_TYPE,”Fahion”);
eventValue.put(AFInAppEventParameterName.CONTENT_ID,”Shirt”);
eventValue.put(AFInAppEventParameterName.CURRENCY,”USD”);
“event_name”:”af_content_view”,
“event_value": {
"af_price":50,
"af_content_type":”Fashion”,
"af_content_id": ”Shirt”,
"af_currency":”USD”
}
AppsFlyerLib.trackEvent(content,AFInAppEventType.CONTENT_VIEW,eventValue);

This will generate an event of type “af_content_view” with the event values
as in the example
* Note:
PRICE: Float – Price of the item being viewed
CONTENT_TYPE : Category of the product being viewed
CONTENT_ID : String
CURRENCY: String
ADD_TO_WISH_LIST
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Map to track User who view a add an item to wishlist
eventValue.put(AFInAppEventParameterName.PRICE,200);
eventValue.put(AFInAppEventParameterName.CONTENT_TYPE,"category_a");
eventValue.put(AFInAppEventParameterName.CONTENT_ID,"item123");
eventValue.put(AFInAppEventParameterName.CURRENCY,"USD");
eventValue.put(AFInAppEventParameterName. QUANTITY,5);
“event_name”:” af_add_to_wishlist”,
“event_value": {
"af_price": 200,
"af_content_type ":"category_a",
"af_content_id": "item123",
"af_currency": "USD",
"af_quantity ": 5
}
AppsFlyerLib.trackEvent(content,AFInAppEventType. ADD_TO_WISHLIST,eventValue);

This will generate an event of type “af_add_to_wishlist” with the event values
as in the example
* Note:
PRICE: Float – Price the the item being added
CONTENT_TYPE : String – Category of the product being added
CONTENT_ID : String – Item being added in wishlist
CURRENCY: String – Currency of the price
QUANTITY: Int – Count how many item of the product
* Note: In case there is more than one category leve, please use the direct
category as below
Ex : "af_content_type": Shirts”
 Fashion category has Men & Woman sub-category
 Men category has Shoes, Shirts, Pants, Jacket sub-category
Item123 belongs to Shirts category, this direct category will be
“af_content_type” value
ADD_TO_CART
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Map to track User who view a add an item to Shopping Cart
eventValue.put(AFInAppEventParameterName.PRICE,200);
eventValue.put(AFInAppEventParameterName.CONTENT_TYPE,"category_a");
eventValue.put(AFInAppEventParameterName.CONTENT_ID,"item123");
eventValue.put(AFInAppEventParameterName.CURRENCY,"USD");
eventValue.put(AFInAppEventParameterName. QUANTITY,5);
“event_name”:” af_add_to_cart”,
“event_value": {
"af_price": 200,
"af_content_type ":"category_a",
"af_content_id": "item123",
"af_currency": "USD",
"af_quantity ": 5
}
AppsFlyerLib.trackEvent(content,AFInAppEventType. ADD_TO_CART,eventValue);

This will generate an event of type “af_add_to_cart” with the event values as
in the example
* Note:
PRICE: Float – Price the the item being added
CONTENT_TYPE : String – Category of the product being added
CONTENT_ID : String – Item being added in cart
CURRENCY: String – Currency of the price
QUANTITY: Int – Count how many item of the product
ADD_PAYMENT_INFO
* Note: In case there is more than one category leve, please use the direct
category as below
Ex : "af_content_type": Shirts”
 Fashion category has Men & Woman sub-category
 Men category has Shoes, Shirts, Pants, Jacket sub-category
 Item123 belongs to Shirts category, this direct category will be
“af_content_type” value
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Map to track User who add payment info detail into app
eventValue.put(AFInAppEventParameterName.SUCCESS,true);
“event_name”:”af_add_payment_info”,
“event_value": {
"af_success":true
}
AppsFlyerLib.trackEvent(content,AFInAppEventType.ADD_PAYMENT_INFO,eventValue);

This will generate an event of type “af_add_payment_info” with the event
values as in the example
* Note:
SUCCESS: boolean – Add payment detail status (true/false)
PURCHASE
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Used to track User who make purchase of any item in the app
eventValue.put(AFInAppEventParameterName.REVENUE,200);
eventValue.put(AFInAppEventParameterName.CONTENT_TYPE,"category_a");
eventValue.put(AFInAppEventParameterName.CONTENT_ID,"item123");
eventValue.put(AFInAppEventParameterName.CURRENCY,"USD");
eventValue.put(AFInAppEventParameterName. QUANTITY,1);
“event_name”:”af_purchase”,
“event_value": {
"af_revenue": 200,
"af_content_type":"category_a",
"af_content_id": "item123",
"af_currency": "USD",
"af_quantity”:1
}
AppsFlyerLib.trackEvent(content,AFInAppEventType.PURCHASE,eventValue);

This will generate an event of type “af_ purchase” with the event values as in
the example
* Note:
REVENUE : Float
CONTENT_TYPE : String
CONTENT_ID : String
CURRENCY: String
QUANTITY: Int
In case there are more than 1 item in one purchase event, please pass each item as
an array element under eventValue object
(See example JSON)
* af_revenue is the only parameter that is used for revenue calculations. Use it for
events that actually represent revenue generation in your business logic. You can use
af_price as a monetary parameter that will not be counted as revenue (such as in an
“Add to Cart” event).
* Note: In case there is more than one category leve, please use the direct
category as below
Ex : "af_content_type": Shirts”
 Fashion category has Men & Woman sub-category
 Men category has Shoes, Shirts, Pants, Jacket sub-category
 Item123 belongs to Shirts category, this direct category will be
“af_content_type” value
In case there are more than 1 item in one purchase event, please pass each
item as an array element under eventValue object
“event_value": [{
"af_revenue": 200,
"af_content_type":"category_a",
"af_content_id": "item123",
"af_currency": "USD",
"af_quantity”:1
},{
"af_revenue": 300,
"af_content_type":"category_b",
"af_content_id": "item987",
"af_currency": "USD",
"af_quantity”:2
}]
TRAVEL_BOOKING
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Used to track User who make travel booking in the app
eventValue.put(AFInAppEventParameterName.REVENUE,200);
eventValue.put(AFInAppEventParameterName.DESTINATION_A,”Singapore”);
eventValue.put(AFInAppEventParameterName.DESTINATION_B,”Jakarta”);
eventValue.put(AFInAppEventParameterName.CLASS,”Economy”);
eventValue.put(AFInAppEventParameterName.CUSTOMER_USER_ID,"[email protected]");
eventValue.put(AFInAppEventParameterName.CONTENT_TYPE,"Flight");
eventValue.put(AFInAppEventParameterName.CONTENT_ID,"Jetstar");
eventValue.put(AFInAppEventParameterName.DATE_A,"2016-01-03 13:23:05");
eventValue.put(AFInAppEventParameterName.DATE_B,"2016-01-29 17:45:05");
eventValue.put(AFInAppEventParameterName.CURRENCY,"USD");
eventValue.put(AFInAppEventParameterName. QUANTITY,1);
“event_name”:”af_travel_booking”,
“event_value": {
“af_revenue“:305,
“af_destination_a“:”Singapore”,
“af_destination_b“:”Jakarta”,
“af_class“:”Economy”,
“af_customer_user_id“:”[email protected]”,
“af_content_type“:”Flight”,
“af_content_id“:”Jetstar”,
“af_date_a” :"2016-01-03 13:23:05",
“af_date_b” :"2016-01-29 17:45:05",
"af_currency": "USD",
"af_quantity": 1
}
AppsFlyerLib.trackEvent(content,AFInAppEventType.TRAVEL_BOOKING,eventValue);

This will generate an event of type “af_ travel_booking” with the event values
as in the example
* Note:
* af_revenue is the only parameter that is used for revenue calculations. Use it for
events that actually represent revenue generation in your business logic. You can use
af_price as a monetary parameter that will not be counted as revenue (such as in an
“Add to Cart” event).
REVENUE : Float – Price of the booking, this will be appear as revenue
DESTINATION_A: String – What is user Departure country
DESTINATION_B: String – What is user Destination country
CLASS: String – Travel Class (Promo, Economy, Business, Vip,…)
CUSTOMER_USER_ID: String – UserID or email (if login)
CONTENT_TYPE : String – Type of Travel (Flight, Train, Ferry)
CONTENT_ID : String – Brand of transport (AirAsia Jetstar, Train type, Ferry type..)
DATE_A: String – Date time user start traveling
DATE_B: String – Date time user reach the destination
CURRENCY: String – Currency of the booking cost
QUANTITY: Int – How many ticket was purchased
SHARE
Map<String, Object> eventValue = new HashMap<String, Object>();
eventValue.put(AFInAppEventParameterName.CONTENT_ID,true);
eventValue.put(AFInAppEventParameterName.DESCRIPTION,true);
AppsFlyerLib.trackEvent(content,AFInAppEventType.SHARE,eventValue);
This will generate an event of type “af_share” with the event values as in the example
* Note:
CONTENT_ID : String – Item that user share )
DESCRIPTION: String – App that user use to share (Whatsapp/Email/Messenger..
Description: Used to track User who share item from an app to others
“event_name”:”af_share”,
“event_value": {
"af_content_id": "item123",
"af_description": "Whatsapp"
}
UPDATE
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Map to track User who update the app
eventValue.put(AFInAppEventParameterName.SUCCESS,true);
“event_name”:”af_update”,
“event_value": {
"af_success":true
}
AppsFlyerLib.trackEvent(content,AFInAppEventType.UPDATE,eventValue);

This will generate an event of type “af_update” with the event values as in
the example
* Note:
SUCCESS: boolean – User update status (true/false)
OPENED_FROM_PUSH_NO
TIFICATION
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Map to track User who open the app from push notification
eventValue.put(AFInAppEventParameterName.SUCCESS,true);
“event_name”:”af_opened_from_push_notification”,
“event_value": {
"af_success":true
}
AppsFlyerLib.trackEvent(content,AFInAppEventType.OPENED_FROM_PUSH_NOTIFICATI
ON,eventValue);

This will generate an event of type “af_open_from_push_notification” with the
event values as in the example
* Note:
SUCCESS: boolean – User open from push notification status (true by default)
TUTORIAL_COMPLETION
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Map to track User who complete tutorial stages
eventValue.put(AFInAppEventParameterName.SUCCESS,true);
eventValue.put(AFInAppEventParameterName.CONTENT_ID,true);
“event_name”:”af_tutorial_completion”,
“event_value": {
"af_success":true,
“af_content_id”:”FinalStage”
}
AppsFlyerLib.trackEvent(content,AFInAppEventType.TUTORIAL_COMPLETION,eventValu
e);

This will generate an event of type “af_tutorial_completion” with the event
values as in the example
* Note:
SUCCESS: boolean – User update status (true/false)
CONTENT_ID : String – Stage of the Tutorial (Depends on app tutorial flow)
LEVEL_ACHIEVED
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Map to track user level when he/she achieve new level in game
eventValue.put(AFInAppEventParameterName.LEVEL,9);
eventValue.put(AFInAppEventParameterName.SCORE,100);
eventValue.put(AFInAppEventParameterName.CONTENT_ID,100);
“event_name”:”af_level_achieved”,
“event_value": {
"af_level": 9,
"af_score": "100",
“af_content_id”:”map 10”
}
AppsFlyerLib.trackEvent(content,AFInAppEventType.LEVEL_ACHIEVED,eventValue);

This will generate an event of type “af_level_achieved” with the event values
as in the example
* Note:
LEVEL: Float – User level
SCORE: String – User score
CONTENT_ID : String – Extra details about game level
ACHIEVEMENT_UNLOCKED
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Map to track user when he/she gain new achievement in game
eventValue.put(AFInAppEventParameterName.SUCCESS,true);
eventValue.put(AFInAppEventParameterName.CONTENT_ID,”Master Skills”);
“event_name”:”af_achievement_unlocked”,
“event_value": {
"af_success":true,
"af_score": "MasterSkills"
}
AppsFlyerLib.trackEvent(content,AFInAppEventType.
ACHIEVEMENT_UNLOCKED,eventValue);

This will generate an event of type “af_achievement_unlocked” with the
event values as in the example
* Note:
SUCCESS: Boolean – User achievement status
CONTENT_ID : String – Achievement information
SPENT_CREDIT
Map<String, Object> eventValue = new HashMap<String, Object>();
eventValue.put(AFInAppEventParameterName.PRICE,6);
eventValue.put(AFInAppEventParameterName.CONTENT_TYPE,”gacha”);
AppsFlyerLib.trackEvent(content,AFInAppEventType.SPENT_CREDIT,eventValue);

This will generate an event of type “af_spent_credits with the event values as
in the example
* Note:
PRICE: Float – Price or Credit value
CONTENT_TYPE : String – What are the credit being spent on (Energy renew, Gacha… )
Description: Map to track user when he/she spent credits/premium currency in
game
“event_name”:”af_spent_credits”,
“event_value": {
"af_price": 6,
"af_content_type": "gacha"
}
ARENA_BATTLE
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Map to track user when he/she completed arena_battle
* Note:
Custom event for game
apps. Not clarified by
Appsflyer
eventValue.put(AFInAppEventParameterName.LEVEL,9);
eventValue.put(AFInAppEventParameterName.SCORE,100);
“event_name”:”ct_arena_battle”,
“event_value": {
"af_level": 6,
"af_score":100
}
AppsFlyerLib.trackEvent(content,AFInAppEventType. ARENA_BATTLE,eventValue);

This will generate an event of type “ct_arena_battle” with the event values as
in the example
* Note:
LEVEL: Float,
SCORE: String
GUILD_JOINED
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Map to track user when he/she join a guild
* Note:
Custom event for game
apps. Not clarified by
Appsflyer
eventValue.put(AFInAppEventParameterName.SUCCESS,true);
eventValue.put(AFInAppEventParameterName.CONTENT_ID,19372);
“event_name”:”ct_guild_joined”,
“event_value": {
"af_success": true,
"af_content_id":19372
}
AppsFlyerLib.trackEvent(content,AFInAppEventType. GUILD_JOINED,eventValue);

This will generate an event of type “ct_guild_joined” with the event values as
in the example
* Note:
SUCCESS: Boolean – True
CONTENT_ID: String – Guild ID
PVP_COMPLETION
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Map to track user when he/she complete PVP in the game
* Note:
Custom event for game
apps. Not clarified by
Appsflyer
eventValue.put(AFInAppEventParameterName.LEVEL,9);
eventValue.put(AFInAppEventParameterName.SCORE,100);
“event_name”:”ct_pvp_completion”,
“event_value": {
"af_level": 6,
"af_score":100
}
AppsFlyerLib.trackEvent(content,AFInAppEventType. PVP_COMPLETION,eventValue);

This will generate an event of type “ct_pvp_completion” with the event
values as in the example
* Note:
LEVEL: Float,
SCORE: String
RESERVATION
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Map to track User after they make a successful reservation
* Note:
Custom event for game
apps. Not clarified by
Appsflyer
eventValue.put(AFInAppEventParameterName.DESTINATION_B,”Jakarta”);
eventValue.put(AFInAppEventParameterName.CUSTOMER_USER_ID,"[email protected]");
eventValue.put(AFInAppEventParameterName.CONTENT_TYPE,"Restaurant");
eventValue.put(AFInAppEventParameterName.CONTENT_ID,"Dintaifung");
eventValue.put(AFInAppEventParameterName.DATE_B,"2016-01-30 19:00:00");
eventValue.put(AFInAppEventParameterName. QUANTITY,2);
“event_name”:”af_reservation”,
“event_value": {
“af_destination_b“:”Jakarta”,
“af_customer_user_id“:”[email protected]”,
“af_content_type“:”Restaurant”,
“af_content_id“:”Dintaifung”,
“af_date_b” :"2016-01-30 19:00:00",
"af_quantity": 2
}
AppsFlyerLib.trackEvent(content,AFInAppEventType.RESERVATION,eventValue);

This will generate an event of type “ct_reservation” with the event values as
in the example
* Note:
DESTINATION_B: String – What is user Destination (Venue Address)
CUSTOMER_USER_ID: String – UserID or email (if login, or Handphone number)
CONTENT_TYPE : String – Type of Reservation (Restaurant/Bar/Service…)
CONTENT_ID : String – Detail of Reservation (Dintaifung/ Collosseum bar/..)
DATE_B: String – Date time user reach the destination
QUANTITY: Int – How many people will come
EVENT_BOOKING
Map<String, Object> eventValue = new HashMap<String, Object>();
Description: Used to track User who make travel booking in the app
* Note:
Custom event for game
apps. Not clarified by
Appsflyer
eventValue.put(AFInAppEventParameterName.REVENUE,200);
eventValue.put(AFInAppEventParameterName.DESTINATION_B,”Collosseum”);
eventValue.put(AFInAppEventParameterName.CLASS,”VIP”);
eventValue.put(AFInAppEventParameterName.CUSTOMER_USER_ID,"[email protected]");
eventValue.put(AFInAppEventParameterName.CONTENT_TYPE,"Music");
eventValue.put(AFInAppEventParameterName.CONTENT_ID,"DJ Afrojack night");
eventValue.put(AFInAppEventParameterName.EVENT_START,"2016-01-03 13:23:05");
eventValue.put(AFInAppEventParameterName.EVENT_END,"2016-01-29 17:45:05");
eventValue.put(AFInAppEventParameterName.CURRENCY,"USD");
eventValue.put(AFInAppEventParameterName. QUANTITY,2);
“event_name”:”ct_event_booking”,
“event_value": {
“af_revenue“:200,
“af_destination_b“:”Collosseum”,
“af_class“:”VIP”,
“af_customer_user_id“:”[email protected]”,
“af_content_type“:”Music”,
“af_content_id“:”DJ Afrojack night”,
“af_event_start” :"2016-01-03 13:23:05",
“af_event_end” :"2016-01-29 17:45:05",
"af_currency": "USD",
"af_quantity": 2
}
AppsFlyerLib.trackEvent(content,AFInAppEventType.EVENT_BOOKING,eventValue);
 This will generate an event of type “ct_event_booking” with the event values
as in the example
* Note:
REVENUE : Float – Price of the booking, this will be appear as revenue
DESTINATION_B: String – What is the Destination
CLASS: String – Travel Class (Promo, Regular, Vip,…)
CUSTOMER_USER_ID: String – UserID or email (if login)
CONTENT_TYPE : String – Type of Event (Music, Food, Art)
CONTENT_ID : String – Event name(Afrojack night, ASEAN Food Festival…)
DATE_A: String – Date time event start
DATE_B: String – Date time event over
CURRENCY: String – Currency of the booking cost
QUANTITY: Int – How many ticket was purchased
* af_revenue is the only parameter that is used for revenue calculations. Use it
for events that actually represent revenue generation in your business logic.
You can use af_price as a monetary parameter that will not be counted as
revenue (such as in an “Add to Cart” event).