Custom User Data

With the updates regarding privacy in the release of iOS 14, app users will now have the option not to share their IDFA. For more information, see our blog post on iOS14 and our iOS14+ section.

Pilgrim enables developers to set custom user unique identifiers in addition to or as a replacement for the IDFA. This is common if you want to tie a Pilgrim event to a specific user in your own database or in a third-party integration.

For example, if your app is using a mobile number and/or an email as a user unique identifier, you can decide to add one or both to your Pilgrim events. Once set, the custom user data will be passed along in the Pilgrim webhook payload.

Where to set custom user data

Generally, we recommend that you set custom user info or user unique identifiers, as soon as you have a way to identify your user i.e upon logging in or once you have their session in the app.

While you do not need to worry about modifying the Pilgrim SDK when a user revokes location permissions, if a user logs out of your app, you should call PilgrimSdk.clearAllData() to reset any unique identifiers that you may have configured.

Examples

let userInfo = UserInfo()

// the String myCustomUserId would be a previously set variable that stores the user's unique id:
userInfo.setUserId(myCustomUserId)

// You can also set other custom fields using the setUserInfo method, where both function parameters accept strings:
userInfo.setUserInfo("+123456789", forKey: "phoneNumber")
userInfo.setUserInfo("jdoe@example.com", forKey: "emailAddress")

// Starting in v2.1.2, you have the ability to persist user info across sessions:
PilgrimManager.shared().setUserInfo(userInfo, persisted: true)

// To unset persisted fields:
PilgrimManager.shared().setUserInfo(nil, persisted: true)
FSQPUserInfo *userInfo = [[FSQPUserInfo alloc] init];

// the String myCustomUserId would be a previously set variable that stores the user's unique id:
[userInfo setUserId:myCustomUserId];

// You can also set other custom fields using:
[userInfo setUserInfo:@"+123456789" forKey: @"phoneNumber"];
[userInfo setUserInfo:@"jdoe@example.com" forKey: @"emailAddress"];

// Starting in v2.1.2, you have the ability to persist userinfo across sessions:
[[FSQPPilgrimManager sharedManager] setUserInfo:userInfo persisted:YES];

// To unset persisted fields:
[[FSQPPilgrimManager sharedManager] setUserInfo:nil persisted:YES];
PilgrimUserInfo userInfo = new PilgrimUserInfo();

// the String myCustomUserId would be a previously set variable that stores the user's unique id:
userInfo.setUserId(myCustomUserId);

// You can also set other custom fields using:
userInfo.put("+123456789", "phoneNumber");
userInfo.put("jdoe@example.com", "emailAddress");

// Starting in v2.1.2, you have the ability to persist userinfo across sessions:
PilgrimSdk.get().setUserInfo(userInfo, persisted: true);

// To unset persisted fields:
PilgrimSdk.get().setUserInfo(null, persisted: true)
val userInfo = PilgrimUserInfo().apply {

// the String myCustomUserId would be a previously set variable that stores the user's unique id:
setUserId(myCustomUserId)

    // You can also set other custom fields using:
    set("+123456789", "phoneNumber")
    set("jdoe@example.com", "emailAddress")

}
// Starting in v2.1.2, you have the ability to persist userinfo across sessions:
PilgrimSdk.get().setUserInfo(userInfo, persisted: true)

// To unset persisted fields:
PilgrimSdk.get().setUserInfo(null, persisted: true)

Testing

There are two ways to test and confirm that you're successfully setting custom user data, via:

If you do not already have webhook ingestion set up, or it's not immediately possible for you to do so, you can easily use ngrok, a tool which allows you to create a tunnel to monitor activity on your local dev machine.

Next Steps

Set up a Webhook

Set up an MMA, CDP or Cloud Data Integration

View our Changelog