User attributes
How it works
Attributes are user features that are stored as key-value pairs. With the help of the attributes you can:
- segment users
- prepare personal storefronts for each group of users in your Web Shop
- transfer user information between different publishing platforms
There are 2 types of user attributes:
- User-editable. The values for this type of attributes are entered by a user or specified according to the in-game logic on the client side. For example, the name and character stats, game difficulty level, etc.
- Read-only. The values for this type of attributes are entered and edited on the server side of your application. We recommend that you use them for configuration of game character stats or user parameters that shouldn’t change regularly. For example, chance to get a bonus, game character key parameters, user categories, etc.
If needed, to ensure integrity of transmitted data you can set attribute validation rules in JSON Schema format in Publisher Account. You can manage the attributes using the Login API methods or webhooks. You can also edit the attributes’ values in your Publisher Account.
How to get it
To set up user attributes:
- Open your project in your Publisher Account and go to the Login section.
- Click Configure in the pane of a Login project.
- Go to the User database block and select the User attributes schema section.
- Specify the attribute validation rules in JSON Schema format (optional):
Note
To enable personalization of your in-game store, add all user attributes to the JSON schema.
- In the
properties
object, specify a set of user attributes and their properties. Allowed data types:string
,number
,integer
, orboolean
. The object’s depth: 1. - In the
additionalProperties
object, specify whether it is possible to create additional fields not listed in theproperties
object. Set the value totrue
if you want to allow additional fields orfalse
to disallow. - In the
required
array, specify a list of required attributes. - Set the value of the
type
field toobject
.
- In the
Note
Each user attribute name is specified individually. Regular expressions, masking, and the
If you do not specify the user attribute type in the JSON schema, the
patternProperties
property are not supported.If you do not specify the user attribute type in the JSON schema, the
type
field will default to the value data_type
when updating the attribute.Copy
- json
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"game": {
"description": "Name of the game played by user.",
"type": "string"
},
"age": {
"description": "User's age.",
"type": "integer"
},
"had_ban": {
"description": "Whether the user was banned.",
"type": "boolean"
},
"last_purchase": {
"description": "Date of user's last purchase.",
"type": "string",
}
},
"additionalProperties": false,
"required": [
"age",
"game",
"last_purchase"
],
"type": "object"
}
- On your website or application, use the following Login API methods to implement the logic of working with user attributes:
Note
When calling the Get user’s attributes from the server method, all user attribute values are returned as strings.
How to edit user attributes values
To edit user attributes values:
- Open your project in your Publisher Account and go to the Login section.
- Click Configure in the pane of a Login project.
- Go to the User database block and select the Users section.
- Find the user in the table and click Attributes in the corresponding string.
- In the pop-up window, select the attribute you want to edit, click on the pencil sign to edit the value, and click Save.
Was this article helpful?
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.Found a typo or other text error? Select the text and press Ctrl+Enter.