Abdul Kadhar
Abdul Kadhar

Reputation: 53

Appsflyer how to record log event

I am new to appsflyer integration. I have used appsflyer in my app. Its send new install count when apps open(using initsdk). Now i want to know how to log/track user login, signin, in-app purchase events. Is appsflyer will send those details to server automatically or i need to script for each events. Is there any default function to call for record it?

Upvotes: 0

Views: 4849

Answers (1)

Andre Rodrigues
Andre Rodrigues

Reputation: 66

What you are looking for is called inApp events, ie, record of specific actions that happen inside the app (after it is opened/launched - default events sent to MMPs usually).

For Appsflyer specifically, you need to fire such events implementing small pieces of code inside the apps:

Android:

public static void logEvent(Context context, String eventName, Map eventValues)

iOS:

- (void) logEvent:(NSString *)eventName withValues:(NSDictionary*)values 

eventName is simply the text that will identify the action recorded in the dashboard later, so it's important that it is self-explanatory. There is a pre-defined list of recommended inApp events here.

eventValues will contain the payload of the events, that can be forwarded to partners on postback format (Google, Facebook, Criteo, etc), so it might be worth populating it with relevant data. For this, there is also a pre-defined list of event parameters that should be worth sending to be properly interpreted later af_revenue) (list here)

Example of a Purchase Event on Android, with 3 items and their respective product ids, quantities and unit prices:

Map<String,Object> eventData = new HashMap<>();
eventData.put(AFInAppEventParameterName.CONTENT_ID, new String[] {"123","988","399"});
eventData.put(AFInAppEventParameterName.QUANTITY, new int[] {2, 1, 1});
eventData.put(AFInAppEventParameterName.PRICE,new int[] {25, 50, 10});
eventData.put(AFInAppEventParameterName.CURRENCY,"USD");
eventData.put(AFInAppEventParameterName.REVENUE,110);
AppsFlyerLib.getInstance().logEvent(AppsFlyerTestActivity.this, AFInAppEventType.PURCHASE,eventData);

More info about it: https://support.appsflyer.com/hc/en-us/articles/115005544169-Rich-in-app-events-for-Android-and-iOS

Upvotes: 1

Related Questions