Xamarin Analytics

Setting User IDs

1
Braze.getInstance(context).ChangeUser("YOUR_USER_ID");

See the Android integration instructions for an in-depth discussion of when and how to set and change a user ID.

1
2
// C#
Appboy.SharedInstance().ChangeUser("YOUR_USER_ID");

See the iOS integration instructions for an in-depth discussion of when and how to set and change a user ID.

Tracking Custom Events

1
Braze.getInstance(context).LogCustomEvent("YOUR_EVENT_NAME");

See the Android integration instructions for an in-depth discussion of event tracking best practices and interfaces.

1
2
// C#
Appboy.SharedInstance ().LogCustomEvent ("YOUR_EVENT_NAME");

Implementation Example - logCustomEvent is utilized within the AppboySampleViewController.cs within the TestApp.XamariniOS sample application.

See the iOS integration instructions for an in-depth discussion of event tracking best practices and interfaces.

Logging Purchases

1
Braze.getInstance(context).LogPurchase("YOUR_PURCHASE_NAME", 100);

See the Android integration instructions for an in-depth discussion of revenue tracking best practices and interfaces.

1
2
// C#
Appboy.SharedInstance ().LogPurchase ("myProduct", "USD", new NSDecimalNumber("10"));

Implementation Example - You can see user properties being set in the sample application’s EventsAndPurchasesButtonHandler method inside AppboySampleViewController.cs.

See the iOS integration instructions for an in-depth discussion of revenue tracking best practices and interfaces.

Setting Custom Attributes

1
2
// C#
Appboy.SharedInstance ().User.FirstName = "YOUR_NAME";

Implementation Example - You can see user properties being set in the sample application’s UserPropertyButtonHandler method inside AppboySampleViewController.cs.

See the iOS integration instructions for an in-depth discussion of attribute tracking best practices and interfaces.

Location Tracking

Social Data Tracking (Android Only)

You can see the Xamarin binding accessing these interfaces in the HomeFragment.cs of our sample app. The sample code logs a social share and populates the Braze user with data from the social networks.

1
2
3
4
5
6
7
// Record Facebook Data
FacebookUser facebookUser = new FacebookUser("708379", "Test", "User", "test@braze.com", "Test", "Testtown", Gender.Male, new Java.Lang.Integer(100), new String[]{"Cats", "Dogs"}, "06/17/1987");
Braze.getInstance(context).CurrentUser.SetFacebookData(facebookUser);

// Record Twitter Data
TwitterUser twitterUser = new TwitterUser(6253282, "Test", "User", "Tester",  new Java.Lang.Integer(100), new Java.Lang.Integer(100), new Java.Lang.Integer(100), "https://si0.twimg.com/profile_images/2685532587/fa47382ad67a0135acc62d4c6b49dbdc_bigger.jpeg");
Braze.getInstance(context).CurrentUser.SetTwitterData(twitterUser);

See the Android integration instructions for an in-depth discussion of social data best practices and interfaces.

WAS THIS PAGE HELPFUL?
New Stuff!