Using a custom identifier

Sometimes you don't want a visitor see a certain experience multiple times, for example a popup that the visitor closes should not return again later, we set a cookie to make sure that doesn't happen. However, if your product runs behind a login then it is best practice to set the customer identifier before loading our snippet. This will make sure the visitor will always have the same id, across devices and even after clearing his cookies.

There are two ways to set the custom identifier before starting the snippet. The first option is to set the unless_id cookie from your backend on page load. Make sure the value of the unless_id cookie is a persistent identifier.

The second option is to set the custom identifier before loading the snippet by setting an option:

window.TxtOptions = {customIdentifier: identifier}

//enter your Unless snippet code below..

Identify by email

Additionally, you can identify a visitor by email. After the identify call, the Unless system can now use the email address of the visitor to show it in the Traffic and Content tabs of the dashboard. Identifying a visitor by email will also unlock some of the integrations we have and gives you the ability to sync these users as contacts to 3rd party CRM systems.

The identify function identifies a visitor in the Unless system.

Txt.identify(email, data, identifier)

The arguments for the identify function are as follows:

emailstringIdentify a visitor by email address. Use this for example when a visitor logs into your system. The email will be used to integrate Unless enriched data to other systems.
Store additional traits to the visitor, see the updateProfile function for a description of the data format.
identifierstringOptionally, use your own unique identifier to associate with our records.

Sample code

// identify the current visitor by email
Txt.identify('[email protected]')