Personalization

captureIdentity - Personalization JavaScript API

End-of-Sale notice!

Acquia announces the end-of-sale for Acquia Personalization effective July 1, 2024. Customers with active service contracts will continue to receive support. If you are interested in experimentation and optimization, contact Acquia Sales Team to get information about Acquia Convert powered by VWO.

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 value

    Select from the following identity types for your use:

    Identity typeDescription
    emailEmail address
    accountAccount ID, possibly an identifier from another tracking system
    facebookFacebook username
    twitterTwitter username
    nameName, including first, middle, last, or any combination of these
    custom identifierCustomized 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'}}]);

Acquia Help

Filter by product:

Personalization common questions

If you can't find what you're looking for, try refining your search or contact our Support teamfor further assistance.