When capturing events, sometimes you may want to directly send identifying visitor information to Personalization such as the website visitor’s email address, social media username, or an identifier from another system (such as a subscriber ID).
Note for Drupal users
You can install and use the Drupal modules on your website to send identifying information to Personalization, including registration and login events and the corresponding email address of a website visitor.
Although you can use functions in the JavaScript API to capture these items, Personalization includes a special identity method which collects this information into a single array of values.
Note
To capture visitor identity with Google Tag Manager, see Capture visitor identity with Google Tag Manager.
To send a website visitor’s identity information directly to Personalization, use the following JavaScript code:
<script>
_tcaq.push(['captureIdentity', '<value>', '<identity-type>']);
</script>
Change the example based on your website’s needs by replacing the following variables:
<value>
- The value you want to assign to a sub-parameter<identity-type>
- An information type that you can populate with a visitor-specific valueSelect from the following identity types for your use:
Identity type Description email
Email address account
Account ID, possibly an identifier from another tracking system facebook
Facebook username twitter
Twitter username name
Name, including first, middle, last, or any combination of these custom identifier Customized visitor-specific information that you want Personalization to treat as an identifier, such as subscriber ID
Sending additional parameters with captureIdentity
The captureIdentity
method can send additional information as parameters, like other Personalization Web capture methods. Send your parameters based on the following example:
_tcaq.push(['captureIdentity', '<value-identity>', '<identity-type>', {'<parameter>':'<value-param>'}]);
Since the captureIdentity
method supports sending only a single identity sub-parameter, you can also add identity
as a special type parameter to your captureIdentity
method, allowing you to send one or more identity values to Personalization.
_tcaq.push(['captureIdentity', '<value-identity>', '<identity-type>', {'<parameter>':'<value-param>'}, {'identity':{'<value-identity-2>':'<identity-type-2>'}}]);
Note
If you are not sending any parameters with a capture event, but are using identity
as a parameter, be sure to include {}
for the empty list of regular parameters.
The following example sends a website visitor’s name and email address using a single JavaScript capture instruction:
_tcaq.push(['captureIdentity', '[email protected]', 'email', {}, {'identity':{'John':'name'}}]);
Sending parameters from Campaign Studio forms
Use the following code to send parameters from Campaign Studio forms to Personalization:
jQuery("#mauticform_genmabcontactus").submit(function(){
var email_mautic = jQuery("#mauticform_input_genmabcontactus_email").val();
_tcaq.push(['captureIdentity', email_mautic, 'email']);
});
In this code, replace:
- “#mauticform_genmabcontactus” with the name of your Campaign Studio form.
- “#mauticform_input_genmabcontactus_email” with the name of your field input.
Sending identity values with other capture methods
If you want to send website visitor identity information associated with a website event (such as a registration event), you can use the identity
method as a parameter in the JavaScript event capture code. The following example captures a page view with an event category of Technology along with the website visitor’s email address:
_tcaq.push(['capture', 'Technology', {}, {'identity':{'[email protected]':'email'}}]);
Interpreting capture-related error messages
Merge failures can occur during visitor information captures due to website visitors having more than 25 identifiers. Visitors often have several identifiers—for example, a new identifier generates for both a visitor signing in to your website from a different browser, and using a different email address. If the Personalization service needs to merge a 26th identifier for a visitor, a new tracking ID generates and merges the new identifier with that tracking ID. This helps to prevent the Personalization service from experiencing performance issues related to oversized visitor profiles.
If a merge failure occurs for a specific website visitor, the Personalization service displays error messages in that visitor’s profile on the People tab. These errors do not affect how Personalization operates, other than by improving its performance, and no user action is required.
Note
Public _tcaq
functions are only available after lift-capture.js
is loaded on a page after personalization return. You will know lift-capture.js
hasn’t loaded on a page if you receive the following reference error:
ReferenceError: _tcaq is not defined