Profile attributes

Transmits user parameters.

Usage example: You can send user parameters to the Post API to supplement user profiles and use this data for audience-based segmentation. For example, add an attribute indicating that the user is a loyalty program member.

Event properties can be passed in parameters or in the body of the request. When you pass data in the body, you should add .csv to the URL of the request. For more information, see Sample request.

To bind an event to a user, you should use one of the following fields in the API request:

  • profile_id
  • appmetrica_device_id

Alert

The Post API has restrictions on loading data. For more information, see Restrictions.

Request format

POST https://api.appmetrica.yandex.com/logs/v1/import/profiles
  ? post_api_key=<string>
  & application_id=<int>
  & profile_id=<string>
  & attributes=<>

post_api_key*

A token for data uploading. You can get it in the Settings section of your application.

application_id*

Unique numeric identifier for the application in AppMetrica.

profile_id*

User profile ID. The Post API allows you only to upload data for identifiers that were previously sent via the SDK.

Alert

Do not pass the value with the appmetrica_device_id parameter. The server accepts only one of these parameters.

attributes*

A set of custom attribute values in {key:value} format. Possible value types: string, number, bool, or counter. If the value of the passed attribute is already written for the profile, it will be overwritten with a new one. Former attribute values will be deleted. Learn more about User profile attributes.

Alert

To collect custom profile attributes, add them in the app settings. To do this, open the app page, select Settings, and click Profile attributes.

First-party data

First-party data (FPD, 1PD) refers to logins, emails, phone numbers, internal identifiers such as user_id and CRM_id, and other data that allows for unambiguous user identification. This enables proper linking of user actions when they perform some actions in the service's web interface and others in the mobile app, or when using different devices (for example, a mobile app on a smartphone and a tablet).

AppMetrica does not store first-party data attribute values in plain text. Passed identifiers are saved in hashed form and are used to match user actions across devices and platforms. The user profile only contains information about which first-party data attributes were passed for that user.

Post API supports sending the following attributes:

  • appmetrica_1pd_phone_sha256_0..appmetrica_1pd_phone_sha256_9 — phone number hashes (no more than 10 values);
  • appmetrica_1pd_email_sha256_0..appmetrica_1pd_email_sha256_9 — email address hashes (no more than 10 values);
  • appmetrica_1pd_telegram_sha256 — Telegram login hash (one value).

Example of a request that sends a phone number hash:

POST https://api.appmetrica.yandex.com/logs/v1/import/profiles
  ? post_api_key=<string>
  & application_id=<int>
  & profile_id=<string>
  & attributes={"appmetrica_1pd_phone_sha256_0":"<string>"}

When sending a request with first-party data attributes, AppMetrica will automatically generate attributes with the names appmetrica_1pd_phone_0..appmetrica_1pd_phone_9, appmetrica_1pd_email_0..appmetrica_1pd_email_9, appmetrica_1pd_telegram.

You can verify that first-party data attributes were passed using boolean profile attributes:

  • appmetrica_1pd_phone_passed — equals true if at least one valid value of the appmetrica_1pd_phone_sha256_* attribute was received from the user.
  • appmetrica_1pd_email_passed — equals true if at least one valid value of the appmetrica_1pd_email_sha_256_* attribute was received from the user.
  • appmetrica_1pd_telegram_passed — equals true if a valid value of the appmetrica_1pd_telegram_sha256 attribute was received from the user.

The AppMetrica interface does not display the passed FPD, but you can verify that a first-party data attribute was passed in the profile list — in segmentation parameters and in groupings by profile attributes in the Predefined attributes subsection.

Segmentation in profile list

segmentation in profile list

Grouping in profile list

grouping in profile list

Sending first-party data attributes is also available via SDK:

Response codes

Code Description
200 Data has been uploaded successfully.
403 The request omitted an authorization header, or an invalid token was specified.
400 One or more required parameters were missing in the request.

Sample request

POST /logs/v1/import/profiles.csv?post_api_key=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ012 HTTP/1.1
Host: api.appmetrica.yandex.com
Connection: close

application_id,profile_id,attributes
1234567890,1234567890abcdef,"{""string_attribute_name"":""string_value"",""number_attribute_name"":1234,""bool_attribute_name"":true,""counter_attribute_name"":-1}"

Sending first-party data:

POST /logs/v1/import/profiles.csv?post_api_key=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ012 HTTP/1.1
Host: api.appmetrica.yandex.com
Connection: close

application_id,profile_id,attributes
1234567890,1234567890abcdef,"{""appmetrica_1pd_phone_sha256_0"":""phone-number-hash"",""appmetrica_1pd_email_0"":""email-hash"",""appmetrica_1pd_telegram"":""login-hash""}"
POST /logs/v1/import/profiles?post_api_key=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ012&application_id=1234567890&profile_id=1234567890abcdef&attributes={"string_attribute_name":"string_value","number_attribute_name":1234,"bool_attribute_name":true,"counter_attribute_name":-1} HTTP/1.1
Host: api.appmetrica.yandex.com
Content-Length: 0
Connection: close

Sending first-party data:

POST /logs/v1/import/profiles?post_api_key=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ012&application_id=1234567890&profile_id=1234567890abcdef&attributes={"appmetrica_1pd_phone_sha256_0":"phone-number-hash","appmetrica_1pd_email_0":"email-hash","appmetrica_1pd_telegram":"login-hash"} HTTP/1.1
Host: api.appmetrica.yandex.com
Content-Length: 0
Connection: close

You can only use the Post API to change the user's custom attributes. To deliver predefined attributes, use the AppMetrica SDK. For more information, see Set up sending profile attributes.

Other Post API methods

If you didn't find the answer you were looking for, you can use the feedback form to submit your question. Please describe the problem in as much detail as possible. Attach a screenshot if possible.

Contact support Suggest an improvement for documentation