External User ID
Add your custom External User Ids within Reteno by the following method:
import { setUserAttributes } from "reteno-react-native-sdk";
setUserAttributes({
externalUserId: "USER_ID",
user,
});When to send your user ID to Reteno >
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 by the following method:
import { setUserAttributes } from "reteno-react-native-sdk";
setUserAttributes({
externalUserId: "USER_ID",
user: {
userAttributes: {
phone: "+380501234567",
email: "[email protected]",
firstName: "John",
lastName: "Doe",
languageCode: "en",
timeZone: "Europe/Kyiv",
marketId: "market_1",
fields: [{ key: "plan", value: "premium" }],
},
subscriptionKeys: ["news"],
groupNamesInclude: ["vip"],
groupNamesExclude: ["inactive"],
},
});The userAttributes object structure:
type Address = {
region?: string | null;
town?: string | null;
address?: string | null;
postcode?: string | null;
};
type Field = {
key: string;
value: string;
};
type Fields = Field[];
type UserAttributes = {
phone?: string | null;
email?: string | null;
firstName?: string | null;
lastName?: string | null;
languageCode?: string | null;
timeZone?: string | null;
marketId?: string | null;
address?: Address | null;
fields?: Fields | null;
};
type User = {
userAttributes?: UserAttributes | null;
subscriptionKeys?: String[] | null;
groupNamesInclude?: String[] | null;
groupNamesExclude?: String[] | null;
};
type SetUserAttributesPayload = {
externalUserId: string;
user: User;
};
NotekeyCustom fields variables. Details >
phoneWe use Google's libphonenumber library for phone number validation. Send phone numbers in the E164 format. A request with an invalid phone number will not be transmitted. You can validate phone numbers by the link.
languageCodeData about language in RFC 5646 format. Primary language subtag in ISO 639-1 format is required. Example: de-AT
timeZoneItem from TZ database. Example:
Europe/Kyiv
MarketId
External market identifier. Available since reteno-react-native-sdk v2.1.0 for setUserAttributes, setMultiAccountUserAttributes, and setAnonymousUserAttributes.
The value can contain up to 64 Latin letters, digits, hyphens (-), and underscores (_).
Pass an empty string ("") to explicitly clear the field on the backend:
setUserAttributes({
externalUserId: "USER_ID",
user: {
userAttributes: {
marketId: "",
},
},
});Omit marketId to keep the existing value unchanged.
Multi-account Support
If one device is shared between multiple accounts and you want push delivery for each account, use setMultiAccountUserAttributes instead of setUserAttributes.
import { setMultiAccountUserAttributes } from "reteno-react-native-sdk";
setMultiAccountUserAttributes({
externalUserId: "USER_ID",
user: {
userAttributes: {
firstName: "John",
lastName: "Doe",
email: "[email protected]",
marketId: "market_1",
},
},
});Anonymous User Attributes
Reteno SDK allows tracking anonymous user attributes. To start tracking information about user without identificator, use setAnonymousUserAttributes function:
function setAnonymousUserAttributes(
payload: AnonymousUserAttributes
): Promise<void>;
type AnonymousUserAttributes = {
firstName?: string | null | undefined;
lastName?: string | null | undefined;
languageCode?: string | null | undefined;
timeZone?: string | null | undefined;
marketId?: string | null | undefined;
address?: Address | null | undefined;
fields?: Fields | null | undefined;
};Example:
import { setAnonymousUserAttributes } from "reteno-react-native-sdk";
setAnonymousUserAttributes({
firstName: "Guest",
lastName: "User",
languageCode: "en",
timeZone: "Europe/Kyiv",
marketId: "market_1",
fields: [{ key: "source", value: "organic" }],
});
NoteYou can't provide anonymous user attributes with phone or/and email. For that purpose use
setUserAttributesmethod with externalUserId
