Expo User Information

External User ID

Add your custom external user ID in Reteno via updateUserAttributes:

import Reteno from 'expo-reteno-sdk';

Reteno.updateUserAttributes({
  externalUserId: 'USER_ID',
  user: {},
});

User Attributes

User attributes are attributes you define to describe segments of your user base, such as language preference or geographic location.

Add user attributes like phone, email, etc. with:

import Reteno from 'expo-reteno-sdk';

Reteno.updateUserAttributes({
  externalUserId: 'USER_ID',
  user: {
    userAttributes: {
      phone: '+380501234567',
      email: '[email protected]',
      firstName: 'John',
      lastName: 'Doe',
      languageCode: 'en',
      timeZone: 'Europe/Kyiv',
      fields: [{ key: 'plan', value: 'premium' }],
    },
    subscriptionKeys: ['news'],
    groupNamesInclude: ['vip'],
    groupNamesExclude: ['inactive'],
  },
});

The userAttributes object structure:

type UserAddress = {
  region?: string | null;
  town?: string | null;
  address?: string | null;
  postcode?: string | null;
};

type UserCustomField = {
  key: string;
  value: string;
};

type UserAttributes = {
  phone?: string | null;
  email?: string | null;
  firstName?: string | null;
  lastName?: string | null;
  languageCode?: string | null;
  timeZone?: string | null;
  address?: UserAddress | null;
  fields?: UserCustomField[] | null;
};

type UserInformationPayload = {
  externalUserId: string;
  user: {
    userAttributes?: UserAttributes;
    subscriptionKeys?: string[];
    groupNamesInclude?: string[];
    groupNamesExclude?: string[];
  };
};

Note

LanguageCode

Data about language in RFC 5646 format. Primary language subtag in ISO 639-1 format is required. Example: de-AT.

TimeZone

Item from TZ database. Example: Europe/Kyiv.

Anonymous User Attributes

Reteno SDK allows tracking anonymous user attributes. Use updateAnonymousUserAttributes:

import Reteno from 'expo-reteno-sdk';

Reteno.updateAnonymousUserAttributes({
  firstName: 'Guest',
  lastName: 'User',
  languageCode: 'en',
  timeZone: 'Europe/Kyiv',
  fields: [{ key: 'source', value: 'organic' }],
});

Note: for phone and/or email, use identified user flow with updateUserAttributes and externalUserId.

Multi-account User Attributes

If multiple Reteno accounts are used in the same app, use updateMultiAccountUserAttributes:

import Reteno from 'expo-reteno-sdk';

Reteno.updateMultiAccountUserAttributes(
  {
    externalUserId: 'USER_ID',
    user: {
      userAttributes: {
        email: '[email protected]',
      },
    },
  },
  'account_suffix'
);