Enable identification signals in the Connect web library
You can enable the Connect library to identify visitors as they are browsing your website. The following forms of identification are supported:
- Addressable fields (emails and phone numbers)
- Client/contact IDs (depending on how your audience is structured).
The identification signal is key to leveraging the power of the other behavioral signals, since it allows us to map a user to those behaviors. Here are the primary reasons the enable identification signals on your website:
- Link user sessions to contacts in your audience
- Compare a user's activity on different devices
- Feed new contacts into your audience
Availability
The identification signal is supported by all types of Connect subscriptions (Pro, Premium and Ultimate).
Configuration
The Connect library provides a method, TLT.logSignal()
with which to send the signal to the Acoustic Connect endpoint, as a JSON object.
The key point in the configuration is to gather the data to populate the identifierValue
field. The most common identifier is an email address, but you could also use a phone number or customer ID, so long as the identifier maps to a unique user. You could read the value from a cookie, session storage, local storage, query strings or the data layer. If none of these options are currently possible, consider discussing the problem with your developers, to see if they can make the identifier available to the Connect library. You could also use the Connect library to monitor the user login API calls (for example, successful user logins).
Unlike other signals, the identification signal should only be sent once per session. One way to ensure this is to write a flag to session storage after it is first sent, and check for the presence of that flag each time the identifier is seen.
Required fields
The logSignal
method requires the following fields for the identification signal.
Field | Values | Definition |
---|---|---|
category | String. Valid value - Behavior . | The category of the signal. Do not edit. |
effect | String. Valid values: - negative - positive | Specify how to interpret the signal. The value will be used for engagement index scoring. |
identifierName | String. Valid values: - email - sms - contactKey | The type of the identifier to use for the signal |
identifierValue | String | The contact information associated with a visitor. The type of identifier depends on the identifierName value.You must provide a value for this field, or the signal will be ignored. |
name | String, up to 256 characters | Assign a name to the signal to differentiate it from other signals. |
signalType | String. Valid value -identification . | The type of signal to enable. Do not edit. |
Optional fields
You can include an optional field to the configuration.
Field | Values | Definition |
---|---|---|
identificationFromLogin | Boolean | If the identifierValue derives from user authentication, set the value to true . If it is taken from a cookie or a query string, use false .This lets you separate sessions where visitors identified themselves explicitly or implicitly. |
Example
// Check that the Connect SDK is present
if (window.TLT && window.TLT.isInitialized()) {
const signal = {
signalType: "identification",
name: "identification generated by web site",
category: "Behavior",
identifierName: "email", // Required
identifierValue: "", // Required
identificationFromLogin: true,
effect: "positive", // Required, must be "positive" or "negative"
signalCustomAttributes: []
};
// Utility function for getting cookie value
const getCookieValue = (name) => (
document.cookie.match("(^|;)\\s*" + name + "\\s*=\\s*([^;]+)")?.pop() || ""
);
if (!sessionStorage.getItem("connect-id-signal")) {
// Check data layer for email
const email = window.prestashop.customer.email || "";
// Use the data layer value, if present
if (email) {
signal.identifierValue = email;
// Else check the "customerID" cookie value
} else {
signal.identifierValue = getCookieValue("customerID") || "";
}
// Optional: display signal in console
console.log("identification signal: " + JSON.stringify(signal, undefined, 2));
// Send signal to Acoustic
window.TLT.logSignal(signal);
// Set a flag so we don't send signal again this session
sessionStorage.setItem("connect-id-signal", "true");
}
}
Updated about 5 hours ago