External User ID
Add your custom External User Ids within Reteno
by the following method:
import { RetenoPlugin } from "сordova-plugin-reteno";
var payload = {
externalUserId: "USER_ID",
user: user,
};
RetenoPlugin.setUserAttributes(payload, success, error);
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 'сordova-plugin-reteno';
setUserAttributes({
externalUserId: "USER_ID",
user: {
userAttributes: userAttributes,
subscriptionKeys: string[],
groupNamesInclude: string[],
groupNamesExclude: string[]
}
})
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;
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;
};
Note
Phone
We 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.
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. To start tracking information about user without identificator, use setAnonymousUserAttributes
function:
function setAnonymousUserAttributes(
payload: AnonymousUserAttributes
): Promise<void>;
type AnonymousUserAttributes = {
user: {
userAttributes: {
firstName?: string | null | undefined;
lastName?: string | null | undefined;
languageCode?: string | null | undefined;
timeZone?: string | null | undefined;
address?: Address | null | undefined;
fields?: Fields | null | undefined;
};
};
};
const userAttributes = {
firstName: this.firstName,
lastName: this.lastName,
languageCode: this.language,
timeZone: this.timezone,
address: retenoAddress,
};
const payload = {
user: { userAttributes },
};
this.retenoPlugin.setAnonymousUserAttributes(payload);
Note
You can't provide anonymous user attributes with phone or/and email. For that purpose use
setUserAttributes
method with externalUserId