Skip to main content
All CollectionsGDPR & Data PrivacyData Collection
How does Batch collect user IDs and manage custom user data?
How does Batch collect user IDs and manage custom user data?

Everything you need to know on how Batch attaches custom user IDs to installs and how you can send custom user data.

Baptiste avatar
Written by Baptiste
Updated over 6 months ago

The custom user ID is a native field you can use to attach a unique user ID to an install. That user ID will act as a reconciliation identifier between installs on Batch side and your user base.

The custom user ID can be:

  • The unique ID used in your login system.

  • Or a stable ID used in your data store (e.g. Firebase, etc) or shared across your CRM or marketing tools (e.g. Salesforce Marketing Cloud, Adobe Campaigns, etc).

  • Or any other stable information that can help you identify a user.

Do not use a volatile id or the anonymous user ID coming from another marketing tool as a custom user ID. Batch already generates an anonymous ID for every installation called the installation ID. You can easily collect it on your end (see more here).

Why should I share a custom user ID with Batch?

By sharing a unique user ID with Batch when users log in, you will be sent notifications to users or send data on your users by simply targeting their user ID. Batch will take care of finding which installs match the user ID you are targeting:

Here are more details on the use cases the custom user id collection unlocks:

  • Send notifications to specific users: As you're able to address Batch with your own type of IDs, Custom User IDs make the use of Transactional API and Custom Audience API much easier.

  • Send custom user data: You will also be able to send raw data on these user IDs from your servers using the Custom Data API.

  • Improve your targeting: From Batch dashboard, you will be able to target users who are or are not logged in to your app (see the 'has Custom user ID' attribute).

  • Simplify debugging: Finally, custom user IDs also make it easier for you to find an installation in the debug tool. From there, you can visualize native and custom data that have been already collected on a user (more information here).

  • Connect Batch to other CRM or marketing tools: Batch will be able to easily connect Batch to any other tools you are already using.

Understanding how Batch collects a custom user ID

Batch registers an anonymous install for:

  • Every user of your app, the first time Batch SDK starts. This usually happens when they open the app for the first time after Batch integration.

  • Every visitor of your website with a compatible browser, the first time Batch JavaScript tag starts. This happens when they visit your website for the first time after Batch integration.

Every install has an anonymous installation ID that identifies it on Batch servers. All the data collected from your app or your website is attached to the installation. You will find more information here on how Batch manages installs and install data.

When users log into your app or your website, you can call Batch SDK methods to share a user ID with Batch (more information here: iOS/Android/Web). Batch SDK will send the user ID to Batch servers and the user ID will be attached to the install:

In the same way, you can use methods of the SDK to clear the custom user ID when your users log out from your app/website. The custom user ID will be detached from the installation.

Sending custom User Data

In addition to the install data collected by the SDK when the app is opened (see more here), you can send custom data on specific user IDs.

This is helpful if, instead of relying on install-level data for your segmentation (e.g. last visit date, last purchase date, etc), you want to have the same custom user data across all the platforms where your service is available (iOS/Android/Web).

This ensures you are always sending the correct message to your users. E.g. avoid sending an abandoned cart alert to your customers on iOS if they just completed the purchase on your website. This is also useful to track data that may change outside of the app (e.g. subscription expiration date, etc) or only available server-side (e.g. last physical store visit date, etc).

Your servers will need to call the Custom Data API to send user data to Batch. You can either send/update data on a specific custom user ID or send data on several user IDs in the same call:

The data will be associated to any install attached to the custom user ID:

If no install has been found for a specific user ID, Batch will store the data. It will be attached automatically if an install is detected with that user ID in the future.

Important note: If users log out from your app or your website, the custom user ID will be detached from the installation. As a consequence, the custom user data will be detached too from the installation.


This article belongs to Batch's FAQ. Need more help? Find insightful articles, documentation, case & market studies, guides, and even more in our website's Resources section on batch.com and our blog.

Did this answer your question?