This guide is intended to be used as a starting point for your app and should be customized. The example app provides a screen by screen breakdown of the different events and parameters that can be collected. At the end of it, there is a table that lists the recommended events and parameters for your app.
ActivatedApp Event Code Example:
/**
* For more details, please take a look at:
* developers.facebook.com/docs/reference/ios/current/class/FBSDKAppEvents
*/
- (void)applicationDidBecomeActive:(UIApplication *)application {
[FBSDKAppEvents activateApp];
}
CompletedRegistration Event Code Example:
/**
* For more details, please take a look at:
* developers.facebook.com/docs/reference/ios/current/class/FBSDKAppEvents
*/
- (void)logCompletedRegistrationEvent :(NSString*)registrationMethod {
NSDictionary *params =
[[NSDictionary alloc] initWithObjectsAndKeys:
registrationMethod, FBSDKAppEventParameterNameRegistrationMethod,
nil];
[FBSDKAppEvents logEvent: FBSDKAppEventNameCompletedRegistration
parameters: params];
}
SpentCredits Event Code Example:
/**
* For more details, please take a look at:
* developers.facebook.com/docs/reference/ios/current/class/FBSDKAppEvents
*/
- (void)logSpentCreditsEvent :(NSString*)contentId
contentType :(NSString*)contentType
valToSum :(double)totalValue {
NSDictionary *params =
[[NSDictionary alloc] initWithObjectsAndKeys:
contentId, FBSDKAppEventParameterNameContentID,
contentType, FBSDKAppEventParameterNameContentType,
nil];
[FBSDKAppEvents logEvent: FBSDKAppEventNameSpentCredits
valueToSum: totalValue
parameters: params];
}
AchievedLevel Event Code Example:
/**
* For more details, please take a look at:
* developers.facebook.com/docs/reference/ios/current/class/FBSDKAppEvents
*/
- (void)logAchievedLevelEvent :(NSString*)level {
NSDictionary *params =
[[NSDictionary alloc] initWithObjectsAndKeys:
level, FBSDKAppEventParameterNameLevel,
nil];
[FBSDKAppEvents logEvent: FBSDKAppEventNameAchievedLevel
parameters: params];
}
UnlockedAchievement Event Code Example:
/**
* For more details, please take a look at:
* developers.facebook.com/docs/reference/ios/current/class/FBSDKAppEvents
*/
- (void)logUnlockedAchievementEvent :(NSString*)description {
NSDictionary *params =
[[NSDictionary alloc] initWithObjectsAndKeys:
description, FBSDKAppEventParameterNameDescription,
nil];
[FBSDKAppEvents logEvent: FBSDKAppEventNameUnlockedAchievement
parameters: params];
}
CompletedTutorial Event Code Example:
/**
* For more details, please take a look at:
* developers.facebook.com/docs/reference/ios/current/class/FBSDKAppEvents
*/
- (void)logCompletedTutorialEvent :(NSString*)contentId
success :(BOOL)success {
NSDictionary *params =
[[NSDictionary alloc] initWithObjectsAndKeys:
contentId, FBSDKAppEventParameterNameContentID,
[NSNumber numberWithInt:success ? 1 : 0], FBSDKAppEventParameterNameSuccess,
nil];
[FBSDKAppEvents logEvent: FBSDKAppEventNameCompletedTutorial
parameters: params];
}
InitiatedCheckout Event Code Example:
/**
* For more details, please take a look at:
* developers.facebook.com/docs/reference/ios/current/class/FBSDKAppEvents
*/
- (void)logInitiatedCheckoutEvent :(NSString*)contentId
contentType :(NSString*)contentType
numItems :(int)numItems
paymentInfoAvailable :(BOOL)paymentInfoAvailable
currency :(NSString*)currency
valToSum :(double)totalPrice {
NSDictionary *params =
[[NSDictionary alloc] initWithObjectsAndKeys:
contentId, FBSDKAppEventParameterNameContentID,
contentType, FBSDKAppEventParameterNameContentType,
[NSNumber numberWithInt:numItems], FBSDKAppEventParameterNameNumItems,
[NSNumber numberWithInt:paymentInfoAvailable ? 1 : 0], FBSDKAppEventParameterNamePaymentInfoAvailable,
currency, FBSDKAppEventParameterNameCurrency,
nil];
[FBSDKAppEvents logEvent: FBSDKAppEventNameInitiatedCheckout
valueToSum: totalPrice
parameters: params];
}
Purchased Event Code Example:
/**
* For more details, please take a look at:
* developers.facebook.com/docs/reference/ios/current/class/FBSDKAppEvents
*/
- (void)logPurchasedEvent :(int)numItems
contentType :(NSString*)contentType
contentId :(NSString*)contentId
currency :(NSString*)currency
valToSum :(double)price {
NSDictionary *params =
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:numItems], FBSDKAppEventParameterNameNumItems,
contentType, FBSDKAppEventParameterNameContentType,
contentId, FBSDKAppEventParameterNameContentID,
currency, FBSDKAppEventParameterNameCurrency,
nil];
[FBSDKAppEvents logPurchase:price
currency: currency
parameters: params];
}
Event Name | Predefined | Suggested Parameters |
---|---|---|
App Install | Yes | |
Launched App | Yes | |
Completed Registration | Yes |
|
Spent Credits | Yes |
|
Achieved Level | Yes |
|
Unlocked Achievement | Yes |
|
Completed Tutorial | Yes |
|
Initiated Checkout | Yes |
|
Purchased | Yes |
|
Purchase Cancelled | Yes |
|
Join Group | No |
|
Create Group | No |
|