Skip to content

Xamarin Analytics

Learn how to generate and review analytics for the Xamarin platform.

Session tracking

The Braze SDK reports session data used by the Braze dashboard to calculate user engagement and other analytics integral to understanding your users. Based on the following session semantics, our SDK generates “start session” and “close session” data points that account for session length and session counts viewable within the Braze dashboard.

To set a user ID or start a session, use the ChangeUser method, which takes a user ID parameter.

1
Braze.GetInstance(this).ChangeUser("user_id");

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

1
App.braze?.ChangeUser("user_id");

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

Logging custom events

You can record custom events in Braze using LogCustomEvent to learn more about your app’s usage patterns and to segment your users by their actions in the dashboard.

1
Braze.GetInstance(this).LogCustomEvent("event_name");

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

1
App.braze?.LogCustomEvent("event_name");

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

Logging purchases

Record in-app purchases using LogPurchase to track your revenue over time and across revenue sources, as well as segment your users by their lifetime value.

Braze supports purchases in multiple currencies. Purchases that you report in a currency other than USD will be shown in the dashboard in USD based on the exchange rate at the date they were reported.

1
Braze.GetInstance(this).LogPurchase("product_id", "USD", new Java.Math.BigDecimal(3.50));

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

1
App.braze?.LogPurchase("product_id", "USD", 3.50);

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

Log purchases at the order level

If you want to log purchases at the order level instead of the product level, you can use order name or order category as the product_id. Refer to our purchase object specification to learn more.

Reserved keys

The following keys are reserved and cannot be used as purchase properties:

  • time
  • product_id
  • quantity
  • event_name
  • price
  • currency

Logging custom attributes

Braze provides methods for assigning attributes to users. You’ll be able to filter and segment your users according to these attributes on the dashboard.

Default user attributes

To assign user attributes automatically collected by Braze, you can use setter methods that come with the SDK. For example, you can set the user’s first name:

1
Braze.GetInstance(this).CurrentUser.SetFirstName("first_name");
1
App.braze?.User.SetFirstName("first_name");

The following attributes are supported:

  • First Name
  • Last Name
  • Gender
  • Date of Birth
  • Home City
  • Country
  • Phone Number
  • Email

Custom user attributes

In addition to our predefined user attribute methods, Braze also provides custom attributes using SetCustomUserAttribute to track data from your applications.

1
Braze.GetInstance(this).CurrentUser.SetCustomUserAttribute("custom_attribute_key", true);

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

1
App.braze?.User.SetCustomAttributeWithKey("custom_attribute_key", true);

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

Location tracking

For an example of logging and tracking analytics, refer to our Android MAUI and iOS MAUI sample applications.

For more information, see the Android integration instructions.

To support local tracking, see iOS: Using background location and the iOS integration instructions.

HOW HELPFUL WAS THIS PAGE?
New Stuff!