コンテンツにスキップ

App user ids

DEA can store the id your app gives each user, so that DEA can count its records per user of your app. This page says which value to send and where to pass it.

Term Meaning
App user id The id your app gives one user. The SDK calls it publisherUserId in AI Data Tasks and appScopedUid in Ads
Device key The key the SDK creates on each device or browser and registers with DEA through attest(). DEA links each record to it
Record What DEA keeps for one task answer, one ad or one activity

Where you pass it

Use case Name Required Platforms
AI Data Tasks publisherUserId Yes. DEA refuses a task request without it Web, Flutter, Android, iOS, React Native
Ads and activities appScopedUid No. DEA stores it only when your app passes it Web (since 0.26.0), Flutter, Android, iOS, React Native

Choose the value

Use the same value for one user in every use case and on every device.

Rule Why
Use an id that does not identify the person: an internal account number, or a random id you keep for each user. Never an email address, a phone number or a name DEA stores the value as it is. A value that names the person makes DEA hold personal data
Keep it stable for the life of the account DEA counts per value. A new value starts a new user
Use the same value in AI Data Tasks and in Ads One value lets you compare both use cases for one user
Use 1 to 128 characters DEA refuses an empty value and a longer value, in AI Data Tasks and in Ads
Use one value per device key in AI Data Tasks DEA binds the device key to the first app user id it receives in a task request, and refuses a different one later. A device key serves one user in AI Data Tasks: on a device that several users share, offer tasks to the first user only
Good Not allowed
u-4821 ken.tanaka@example.com
7f3c9a1e-2b4d-4e8f-9a6c-1d2e3f4a5b6c +81 90 1234 5678

AI Data Tasks

Pass the app user id as publisherUserId to every task request: the project list and each task.

Platform Where
Web listProjects(sdk, { publisherUserId }) and contribution.start({ publisherUserId, projectId })
Flutter, Android, iOS, React Native The publisher_user_id claim of the project list request, and publisherUserId in the boot message your app delivers to the task page

Each platform's AI Data Tasks page shows the code: Web, Flutter, Android, iOS, React Native.

The answer itself does not carry the app user id. DEA links the answer to the user through the device key that signed both the task request and the answer.

Ads and activities

Pass the app user id as appScopedUid. The SDK signs it into the proof, and DEA stores it on the record of the ad or the activity.

Platform Call
Web Since 0.26.0: ads.session_opened(surface, adUnit, { appScopedUid: userId }). The SDK signs the same value into the click and the end
Android getProof(event, sessionId = id, adUnit = adUnit, appScopedUid = userId)
iOS getProof(event: event, sessionId: id, adUnit: adUnit, appScopedUid: userId)
Flutter getProof(sessionId: id, event: event, adUnit: adUnit, appScopedUid: userId)
React Native getProof(event, {sessionId: id, adUnit, appScopedUid: userId})

On Flutter, Android, iOS and React Native, pass the same value to every proof of one ad or one activity: the start, the click if there is one, and the end. Each platform's Ads page shows the code: Web, Flutter, Android, iOS, React Native.

Check it

What you see Why What to do
A task request ends with errorCode IDENTITY_MISMATCH The device key is bound to another app user id A device key serves one user in AI Data Tasks. Do not offer tasks to another user on this device, and never send another user's id in place of the current user's: DEA would credit the wrong user
A task request ends with errorCode CLAIM_PROFILE The app user id is empty or longer than 128 characters Send 1 to 128 characters
DEA refuses an ad or activity proof with a 4xx (on the Web, session_opened() resolves null and ads.counts.delivery.dropped moves) Among other causes, an appScopedUid that is empty or longer than 128 characters Send 1 to 128 characters, or leave appScopedUid out