The profiles API is used to fetch information about the user profile from Burt Profiles.
The API gives access to the profile ID and segments belonging to the current user’s profile in Burt Profiles. The profile ID may be useful for connecting and/or identifying users in integrations with third party systems. Applications for the segments include customizing the user experience, for example advertising targeting or content recommendations.
Some third party system integrations, for example ad servers, will require that the ID and segments are available early on during page load. But since the profiles methods are not synchronous, for this case it is recommended to maintain your own local cache of the values, using a cookie or DOM localStorage. This way, the values can be read early on during page load on subsequent page views.
Let’s assume you want to track and display some web page content only
for users belonging to a specific segment in Burt Profiles. The
following example will invoke the function showInfoBox
when the user
belongs to segment 1234
:
Please note that the burtApi.profiles
namespace will not be
available before startTracking
has been called.
(callback)
(callback)
(callback(id))
Requests the user’s profile ID from Burt, invoking callback
with the
id
upon success. If no profile ID is found for the current user,
id
will be null
.
(callback(segments))
Requests the user’s segments from Burt, invoking callback
with the
segments
as an array upon success. If no segments are found for the
current user, segments
will be an empty array.