Legacy Documentation: Version 5.1
Custom Events (optional)
Unity Analytics (SDK - for use with Unity versions prior to 5.1)

User Attributes (optional)

Depending on the genre of your project, creating custom segments around gender and age of your users may interest you. Whether you’re receiving this information on signup of your project, or from a third-party SDK, eg: Facebook, you can send these demographics to Unity Analytics.

 // Reference the Unity Analytics SDK package
  using UnityEngine.Analytics;

  // Use this call to designate the user gender
  Analytics.SetUserGender(Gender gender);

  // Use this call to designate the user birth year
  Analytics.SetUserBirthYear(int birthYear);
Name Type Description
gender enum Gender of used can be “Female”, “Male or ’Unknown”.
birthYear int Birth year of user. Must be 4-digit year format only.

For example:

  Gender gender = Gender.Female;
  Analytics.SetUserGender(gender);

  int birthYear = 2014;
  Analytics.SetUserBirthYear(birthYear);

Validate User Attributes (optional)

The Unity Editor can act as a test environment to validate the Unity Analytics integration. This means that it is not required that you build and publish your game in order to validate the Basic Integration.

Validate Your Integration

To send test data to our servers and validate your integration, simply play your game by pressing the Play button.

Custom Events (optional)
Unity Analytics (SDK - for use with Unity versions prior to 5.1)