Identifies the current user with their user_id
or email
.
Deprecated API Warning
This page documents a no-longer supported version of the Boomtrain JavaScript Library (versions 4.x and below). The new
p13n.js
library, documented here is the currently supported library for integrating with ZetaHub.
If your website uses authentication or another form of client-side identification and you therefore know who is browsing, call identify
with this user's unique identifier on login or upon start of the identified session. When called, analyticstrain
library will store this identity in the user's browser to ensure that any subsequent behavior is tracked using that identity.
In addition, we will merge any anonymous browsing history from this browser into the identified user profile.
If a different identified user was browsing at the time this function is called, the new identity passed into this function will supersede the previous identity, and the newly logged-in user's identity will be used for subsequent behavioral tracking in this browser.
_bt.identify(identifier, [callback]);
The identify
call has the following fields:
Field | Description | |
---|---|---|
identifier | Object | An identifier for this new user, either a user_id or an email address. This value must be a case-insensitive unique identifier for your user. See Identifier Format below for details. |
callback optional | Function | A function that is executed after this function completes and the browser is now identified according to the identifier. |
Note that if at any time the user logs out, the Clear function should be called to ensure that the browser is no longer associated with this identified user.
Identifier Format
The identify
function allows you to identify a user with either a unique user ID or an email address. These must be specified exactly as either a user_id
or an email
property of the object, and only one of these two may be specified. When an email
is specified, this email will be added to the contacts
field for this user in the Boomtrain Marketing Engine.
_bt.identify(
{'user_id':'example_user'},
);
_bt.identify(
{'email':'[email protected]'}
);