This guide is intended to be used as a starting point for your app and should be customized for your app's needs. 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 | ActivatedApp Event Code Example:
|
Searched Event Code Example:
/**
* For more details, please take a look at:
* developers.facebook.com/docs/reference/ios/current/class/FBSDKAppEvents
*/
- (void)logSearchedEvent :(NSString*)contentType
searchString :(NSString*)searchString
success :(BOOL)success {
NSDictionary *params =
[[NSDictionary alloc] initWithObjectsAndKeys:
contentType, FBSDKAppEventParameterNameContentType,
searchString, FBSDKAppEventParameterNameSearchString,
[NSNumber numberWithInt:success ? 1 : 0], FBSDKAppEventParameterNameSuccess,
nil];
[FBSDKAppEvents logEvent: FBSDKAppEventNameSearched
parameters: params];
}
ViewedContent Event Code Example:
/**
* For more details, please take a look at:
* developers.facebook.com/docs/reference/ios/current/class/FBSDKAppEvents
*/
- (void)logViewedContentEvent :(NSString*)contentType
contentId :(NSString*)contentId
currency :(NSString*)currency
valToSum :(double)price {
NSDictionary *params =
[[NSDictionary alloc] initWithObjectsAndKeys:
contentType, FBSDKAppEventParameterNameContentType,
contentId, FBSDKAppEventParameterNameContentID,
currency, FBSDKAppEventParameterNameCurrency,
nil];
[FBSDKAppEvents logEvent: FBSDKAppEventNameViewedContent
valueToSum: price
parameters: params];
}
AddedToWishList Event Code Example:
/**
* For more details, please take a look at:
* developers.facebook.com/docs/reference/ios/current/class/FBSDKAppEvents
*/
- (void)logAddedToWishlistEvent :(NSString*)contentId
contentType :(NSString*)contentType
currency :(NSString*)currency
valToSum :(double)price {
NSDictionary *params =
[[NSDictionary alloc] initWithObjectsAndKeys:
contentId, FBSDKAppEventParameterNameContentID,
contentType, FBSDKAppEventParameterNameContentType,
currency, FBSDKAppEventParameterNameCurrency,
nil];
[FBSDKAppEvents logEvent: FBSDKAppEventNameAddedToWishlist
valueToSum: price
parameters: params];
}
AddedToCart Event Code Example:
/**
* For more details, please take a look at:
* developers.facebook.com/docs/reference/ios/current/class/FBSDKAppEvents
*/
- (void)logAddedToCartEvent :(NSString*)contentId
contentType :(NSString*)contentType
currency :(NSString*)currency
valToSum :(double)price {
NSDictionary *params =
[[NSDictionary alloc] initWithObjectsAndKeys:
contentId, FBSDKAppEventParameterNameContentID,
contentType, FBSDKAppEventParameterNameContentType,
currency, FBSDKAppEventParameterNameCurrency,
nil];
[FBSDKAppEvents logEvent: FBSDKAppEventNameAddedToCart
valueToSum: price
parameters: params];
}
AddedPaymentInfo Event Code Example:
/**
* For more details, please take a look at:
* developers.facebook.com/docs/reference/ios/current/class/FBSDKAppEvents
*/
- (void)logAddedPaymentInfoEvent :(BOOL)success {
NSDictionary *params =
[[NSDictionary alloc] initWithObjectsAndKeys:
[NSNumber numberWithInt:success ? 1 : 0], FBSDKAppEventParameterNameSuccess,
nil];
[FBSDKAppEvents logEvent: FBSDKAppEventNameAddedPaymentInfo
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 | |
Searched | Yes |
|
Viewed Content | Yes |
|
Added to Wishlist | Yes |
|
Added to Cart | Yes |
|
Initiated Checkout | Yes |
|
Added Payment Info | Yes | |
Purchased | Yes |
|