SDK
HomePromoteAnalyzeDevelopResources
4.5.0
4.5.0
  • SDK Overview
    • Tracking Documentation
      • Android
      • iOS & SKAdNetwork
      • Retargeting
    • Predefined Events
    • Find your justtrack token
  • Android
    • Overview
      • Retargeting users
      • Revenue
      • UserEvent API
      • Demo
      • Changelog
    • Set up the SDK
    • Send user events
    • Get the justtrack user ID
    • Get an attribution
    • Get an advertiser and test group ID
    • Integrate third-party SDKs
  • iOS
    • Overview
      • Track sessions
      • UserEvent API
      • Changelog
    • Set up the SDK
    • Send user events
    • Get the justtrack user ID
    • Get an attribution
    • Get an advertiser and test group ID
    • Integrate third-party SDKs
    • Request tracking authorization
  • Unity
    • Overview
      • Forward Ad Impressions
      • UserEvent API
      • Changelog
    • Install the SDK
    • Install the dependencies
    • Add the prefab
    • Send user events
    • Get a justtrack user ID
    • Get an attribution
    • Get an advertiser and test group Id
    • Provide your own user Id
    • Integrate third-party SDKs
    • Forward in-app purchases
    • Get an affiliate link
    • Configure your iOS application
Powered by GitBook
On this page
  • UserEvent Constructors
  • UserEvent setters
  • UserEvent restrictions
  1. Android
  2. Overview

UserEvent API

When you build a UserEvent, you can either:

  • Provide values to the constructor.

  • Initialize an empty event and later call setters for other properties.

UserEvent Constructors

UserEvent has the following constructors:

class UserEvent {
    public UserEvent(@NonNull String name)
    public UserEvent(@NonNull String name, double value, @NonNull Unit unit)
    public UserEvent(@NonNull String name, @NonNull Money money)
}

The only requirement for a new event is a name. Once you've assigned an event name, it can later no longer be changed.

The value and unit can only be provided together and default to 0 and no unit if not provided. Alternatively, an event can carry a monetary value instead of a value with a unit.

UserEvent setters

You can also set properties and dimensions after initialization, using the following methods:

public UserEvent addDimension(String, String);
public UserEvent addDimension(Dimension, String);
public UserEvent removeDimension(String);
public UserEvent removeDimension(Dimension);
public UserEvent setValue(double, Unit);
public UserEvent setValue(Money);

// convenience wrappers for .setValue()
public UserEvent setCount(double);
public UserEvent setSeconds(double);
public UserEvent setMilliseconds(double);

UserEvent restrictions

When you create a custom event, you must adhere to the following requirements:

  • The event name:

    • Cannot be empty.

    • Must be shorter than 256 characters.

    • Is case-sensitive.

    • Can only consist of printable ISO 8859-1 characters (U+0020 to U+007E as well as U+00A0 to U+00FF).

  • Dimension names:

    • Must be shorter than 256 characters.

    • May only consist of:

      • lowercase letters in the latin alphabet (U+0061 to U+007A)

      • underscores (U+005F)

      • numbers (U+0030 to U+0039)

  • Dimension values:

    • Must be shorter than 4096 characters

    • Can only consist of printable ISO 8859-1 characters (U+0020 to U+007E as well as U+00A0 to U+00FF).

  • The event can have a maximum of 10 total dimensions.

  • The value of a user event must be finite (i.e., not NaN or ±Infinity).

  • If you provide a monetary value, the currency needs to be a 3 letter uppercase ISO 4217 string.

If your event does not match the following criteria, it will not be recorded in the justtrack platform.

Last updated 1 year ago