Social Data Tracking

Collecting Social Account Data

The Braze iOS SDK does not automatically collect Facebook or Twitter user data. If you want to integrate Facebook user data in Braze user profiles, you need to fetch the user’s data and pass it to Braze.

Passing Facebook Data To Braze

Initialize ABKFacebookUser objects with the Facebook data you have collected and pass it to Braze:

1
2
ABKFacebookUser *facebookUser = [[ABKFacebookUser alloc] initWithFacebookUserDictionary:self.facebookUserProfile numberOfFriends:self.numberOfFacebookFriends likes:self.facebookLikes];
[Appboy sharedInstance].user.facebookUser = facebookUser;
1
2
let facebookUser = ABKFacebookUser(facebookUserDictionary: facebookUserDictionary, numberOfFriends: numberOfFriends, likes: likes)
Appboy.sharedInstance()?.user.facebookUser = facebookUser

In ABKFacebookUser’s init method initWithFacebookUserDictionary:numberOfFriends:likes:, all the parameters should be dictionaries and arrays returned directly from Facebook:

Parameter Definition
facebookUserProfile The dictionary returned from the endpoint “/me”.
numberOfFriends The length of the friends array returned from the endpoint “/me/friends”.
likes The array of user’s Facebook likes from the endpoint “/me/likes”.

For additional information regarding the Facebook Graph API, please refer to the Facebook Graph API Developer Documentation.

Additionally, you can tailor what Facebook data you’re sending to Braze, in case you don’t want to include the entire basic profile. For example:

1
ABKFacebookUser *facebookUser = [[ABKFacebookUser alloc] initWithFacebookUserDictionary:facebookUserPublicProfile numberOfFriends:-1 likes:nil];  
1
let facebookUser = ABKFacebookUser(facebookUserDictionary: facebookUserDictionary, numberOfFriends: -1, likes:nil)

For more information about integrating the Facebook SDK, follow the steps in Facebook SDK documentation.

Passing Twitter Data To Braze

Initialize ABKTwitterUser objects, set up the Twitter data you have collected and pass it to Braze:

1
2
3
4
ABKTwitterUser *twitterUser = [[ABKTwitterUser alloc] init];
twitterUser.userDescription = self.userDescription;
twitterUser.twitterID = self.twitterID;
[Appboy sharedInstance].user.twitterUser = twitterUser;
1
2
3
4
let twitterUser = ABKTwitterUser()
twitterUser.userDescription = twitterDserDescription
twitterUser.twitterID = twitterID
Appboy.sharedInstance()?.user.twitterUser = twitterUser
WAS THIS PAGE HELPFUL?
New Stuff!