Profiles

Extending your user data with LiveLike profiles

Profiles are used to collect fan activity on LiveLike inside a single identity. Integrations should associate each of their users with a profile.

Identifiers

Each profile has an ID, and an optional custom ID. The ID is assigned by LiveLike, but you can assign your own custom IDs. If you want to reuse user IDs from your system, store them in the Custom Profile IDs.

Authenticating

Interactions with the LiveLike service are authenticated with an Access Token. You can generate your own access tokens from your backend with Client-generated Access Tokens, or you can store the access tokens that are generated when creating a new profile.

Personalizing and customizing

Nicknames are used for personalization, and show up next to chat messages and in leaderboards, as well as inside of the CMS to help you identify users. If you have a username or display name in your system, you should use it as the profile's nickname.

🚧

Nicknames are not guaranteed to be unique.

Creating a profile

A new profile will be created when initializing the SDKs without an access token.

const newProfile = await LiveLike.init({ accessToken })

Profiles can also be explicitly created.

const newProfile = await LiveLike.createUserProfile({ nickname: 'New Nickname' })
// the access token is in profile.access_token

Updating a profile

const updatedProfile = await LiveLike.updateUserProfile({
  accessToken,
  options: {
    nickname: 'New Nickname'
  }
})
sdk.updateChatNickname(nickname)
sdk.updateUserCustomData(<jsonString>,object:LiveLikeCallback<LiveLikeUserApi>(){
	override fun onResponse(result: LiveLikeUserApi?, error: String?) { 
  		
  })
})
sdk.setUserDisplayName("<new display name>") { [weak self] result in
      guard let self = self else { return }
      switch result {
      case .success:
          print("Successfuly changed user display name")
      case let .failure(error):
          print("Error \(error.localizedDescription)")
      }
   }
 }
📘

Looking for chat avatar images?

Avatars are handled as part of the chat system. Read more in the Chat Avatars section.

Integration strategies

Generally integrations should associate each of their users with a LiveLike profile. In that case, using a persistent strategy is the recommended approach. If your integration doesn't have a user concept, or each session should be considered an independent user, the local strategy can work.

🚧

Track your profiles!

While you can initialize the SDKs and create profiles arbitrarily, each new profile counts as a LiveLike user. If you are using metered MAU billing, it is important that your integration does not generate more profiles than it needs. If you want to keep your profile count in line with your own user count, ensure that each user in your system has only one LiveLike profile associated with them, and that they use the same profile each time they use your app.

Persistent profiles

Profiles should be associated with your own user accounts if you have them. The user Access Token can be stored as a field in your user database. That allows you to re-use the same access token when a user reinstalls an app or signs in on another device. To understand how to tie profiles to your user accounts, see Integrating with Logins.

If you have an access token, you can initialize the SDK with it to reuse the same profile across sessions.

// You cannot set the access token outside of this initializer.
// If you need to change or remove an access token you should reinitialize the EngagementSDK.

class SampleClass {
    private func setupEngagementSDK(clientID: "<client-id>") {
        var sdkConfig = EngagementSDKConfig(clientID: clientID)
        sdkConfig.accessTokenStorage = self
        let sdk = EngagementSDK(config: sdkConfig)
    }
}

extension SampleClass: AccessTokenStorage {
    func fetchAccessToken() -> String? {
         return "<access token>"
    }
    
    func storeAccessToken(accessToken: String) {
        // store access token
    }
}
const profile = await LiveLike.init({
  clientId,
  accessToken
});

Local profiles

Anonymous experiences can be created by persisting credentials in volatile storage, like a session store. These profiles will persist for the lifetime of the store. For example on mobile devices, you can store the profile in local storage. The profile can be reused, as long as the user doesn't clear local storage or reinstall the application.

671

Workflow for storing profile access tokens locally