Skip to main content
By default, Grantiva identifies devices anonymously. You can optionally associate a user identity for:
  • Feature flags targeted by user properties
  • Feedback that persists across devices for the same user
  • Analytics grouped by user rather than device

Identify a user

Or with just a user ID:
All services (feedback, flags) automatically use this context after identification. Caches are cleared on identity change so services re-fetch with the new context.

UserContext

Properties are used for feature flag targeting and segmentation. Common examples:
  • "plan": "free", "pro", "business"
  • "country": "US", "DE", "JP"
  • "beta_tester": "true"
  • "company_size": "50"

Subject ID (subscription sharing unit)

Separate from user identity, setSubjectId links the device to a sharing unit (family/household) for subscription entitlement claims (SDK 2.1.0+, Enterprise):
The id rides the next attestation or token refresh; the backend then projects custom_claims.subscription into the JWT for every device sharing the same id. Use the identical value as the StoreKit appAccountToken and Stripe client_reference_id. Don’t confuse the two:

Device context (automatic)

The SDK automatically collects device context — you don’t need to set this:

Clear identity

Call on user logout:
Services fall back to device-based identity. Feedback submitted before logout remains associated with the user.

Read current identity