Experience API
Updating and receiving information of a user profile.
The Experience API is the core of Ninetailed. It provides a unique user profile for each visitor to your content blazingly fast.
Usually, in a first step, a user profile must be created or updated. The Experience API allows you to create and update Ninetailed profiles by providing a payload of one or more events. The API will then respond with updated versions of all profiles created or updated by those events.
Note that the payload you supply to these endpoints can be sent with the
content-type
header set as either application/json
or text/plain
. Our SDKs automatically send requests as text/plain
and we recommend that you use text/plain
whenever possible to minimize request roundtrip time by avoiding triggering a CORS preflight request. If you do not have a profile id or identifier of the current user, use the following API call:
post
https://experience.ninetailed.co/v2
/organizations/{organizationId}/environments/{environmentSlug}/profiles
Create Profile
Alternatively, if you already have a profile id or identifier, use the following API call:
We highly recommend that you use the
profileID
that is returned by the Ninetailed profile once you have identified the user. Retrieving and updating profiles with this profileID
resolved much faster than using a custom identifier.post
https://experience.ninetailed.co/v2
/organizations/{organizationId}/environments/{environmentSlug}/profiles/{profileId}
Upsert Profile
In most cases, you want to send a specific event (such as a page view) to the Experience API, which will automatically return the updated profile. However, if you would like to just retrieve the current profile, you can do so with the following command.
We highly recommend that you use the
profileID
that is returned by the Ninetailed profile once you have identified the user. Retrieving and updating profiles with this profileID
resolved much faster than using a custom identifier.get
https://experience.ninetailed.co/v2
/organizations/{organizationId}/environments/{environmentSlug}/profiles/{profileId}
Get Profile
You might also use the endpoints of this API to push data from your own existing customer data systems into Ninetailed profiles in real time, in periodic batches, or in bulk as part of a first-time migration.
post
https://experience.ninetailed.co/v2
/organizations/{organizationId}/environments/{environmentSlug}/events
Batch Upsert Profiles
The Ninetailed Experience API computes and returns a visitor's profile in response to
page
, track
, and identify
events. The profile is also used within Ninetailed's Experience SDKs to determine the appropriate experience variants and Merge Tag values to render.type Profile = {
/**
* An id which can get set by you - e.x. CRM id.
*/
id?: string;
/**
* This is an internal identifier to find the visitor in our system.
*/
anonymousId: string;
/**
* The IDs of the audiences to which the profile belongs.
*/
audiences: string[];
/**
* Traits you have set via identify(id: string, traits: Traits) calls.
*/
traits: Traits;
/**
* The current location of the user.
*/
location: Location;
};
traits
is a json dataset that can be set by you through identify calls. Whenever you send new traits to our system we merge the traits of the user. traits
are commonly used in merge tags to build inline Personalizations.Example for an inline Personalization:const headline = `Hey ${profile.traits.firstname}👋`
.
type Traits = {
[key: string]: string | number | boolean | Traits;
};
// example
const traits: Traits = {
"firstname": "Max",
"address": {
"street": "Allee 33"
},
"company": "Wayne Enterprises, Inc."
}
location
is the last seen location of the user. You would normally use this to merge it into Richtext.type Location = {
coordinates?: {
latitude: number;
longitude: number;
};
city?: string;
postalCode?: string;
region?: string;
regionCode?: string;
country?: string;
continent?: string;
timezone?: string;
};
Last modified 2mo ago