Skip to content

Audience

The audience of your product are all users who interact with it. The LMG SDK uses a very flexible style of identifying and tracking users to support any number of use cases and login systems.

There are 3 states a user can be in:

  • Anonymous - ie. anonymous
  • Identified - Associated with a unique user id, but not verified
  • Verified - Associated with a unique user id, and verified via a signed token

Anonymous Usage

When the SDK is first initialized, a unique session is generated. This is an anonymous identifier for the current user that lasts for the lifecycle of the app usage. If you do not have login functionality or want to have fully anonymous usage, you don't need to proceed.

Identifying Users

Identifying users registers all the app activity with a particular user id. This is generally the unique id you use to identify the user in your auth system.

You identify a user by calling:

LoopMediaGroup.client().identify("UNIQUE_USER_ID", null);
LoopMediaGroup.client().identify("UNIQUE_USER_ID", null)

Verifying Users

A verified user is considered to be "logged in". Users are verified by setting a signed token before calling identify:

LoopMediaGroup.client().identify("UNIQUE_USER_ID", "HMAC_TOKEN");
LoopMediaGroup.client().identify("UNIQUE_USER_ID", "HMAC_TOKEN")

The HMAC token is generated based on the Audience Identification Secret key that is unique to your property. It allows the Loop Media Platform to trust that this user is actually authenticated.

For details and an example implementation, see our API docs.

Resetting Authentication

LoopMediaGroup.client().logout();
LoopMediaGroup.client().logout()

Updating Profiles

You can send any user profile data you like to the Loop Media Platform via profile traits. There are standard user attributes that have defined values and are common to all users, and custom user attributes that are unique to your app.

Profile traits are used to generate automatic demographic reports and interest profiles. They can also be used to build custom Audience segments and add relevance to Collections, search, and other platform features.

Standard Traits

Standard user attributes such as a user's name or email address can sent during the identify process:

Profile profile = new Profile.Builder("UNIQUE_USER_ID")
.name("John Doe")
.email("john.doe@gmail.com")
.gender(Gender.Male)
.build();

LoopMediaGroup.client().identifyWithTraits("UNIQUE_USER_ID", null, profile);
val profile = Profile.Builder("UNIQUE_USER_ID")
.name("John Doe")
.email("john.doe@gmail.com")
.gender(Gender.Male)
.build()

LoopMediaGroup.client().identifyWithTraits("UNIQUE_USER_ID", null, profile)

You can also update traits after the user has been identified by calling:

LoopMediaGroup.client().updateUserTraits(profile);
LoopMediaGroup.client().updateUserTraits(profile)

Custom Traits

Typically our customers see a lot of value in sending custom data that relates to customer development, such as price plan, value of purchases, etc.

Profile profile = new Profile.Builder("UNIQUE_USER_ID")
.trait("paid_subscriber", true)
.trait("monthly_spend", 155.5)
.trait("account_tier", "gold")
.build();
val profile = Profile.Builder("UNIQUE_USER_ID")
.trait("paid_subscriber", true)
.trait("monthly_spend", 155.5)
.trait("account_tier", "gold")
.build()