capture - Acquia Lift JavaScript API

Although Acquia Lift can capture visitors' webpage views on their own, there are other methods that can be used to capture data as well. Each of the following methods can make use of additional variables to capture more specific information:

Metatags

Acquia Lift determines the page context to utilize when tracking captures and segmenting users. Acquia Lift can collect custom additional page information using the Capture API. The Acquia Lift visitor profile custom fields allow the definition of user-defined fields to capture information specific to a customer site. Acquia Lift passes these values along with capture data when specified within <meta> tags in the <head> section of a page or when specified in the global Acquia Lift JavaScript scope. To pass capture data or user-defined fields using a metatag, the metatag should be added to the <head> in the following format:

<meta itemprop="acquia_lift:custom-field-name" content="custom-field-value">

From the preceding format, custom-field-name is the parameter used by captureView, which is the field name used by the data warehouse. The custom-field-value parameter is the value to track for that field. The custom field name uses the format acquia_lift:[TABLE]_udf[NUMBER], where:

  • [TABLE] is either person, touch, or event.
  • [NUMBER] is the custom field selected when creating the custom column meta data.

For example, if person_udf50 represents Industry, and the current visitor's industry is the healthcare industry, then the metatag for the page capture will be the following:

<meta itemprop="acquia_lift:person_udf50" content="Healthcare">

To pass the same information directly using JavaScript, use the following code:


window.AcquiaLift = window.AcquiaLift || {};
window.AcquiaLift.profile = window.AcquiaLift.profile || {};
window.AcquiaLift.profile.person_udf50 = 'Healthcare';

If the same field is defined in both a metatag and within JavaScript, the value defined within JavaScript will be used.

JavaScript variables

You can also define variables directly in your page's JavaScript, similar to the following:

window.AcquiaLift.profile.person_udf5 = 'my dynamic content goes here';

The default timeout that is set in both lift.js and the /decide-js endpoint is 30 seconds. You can alter the timeout value for all calls (except authentication calls) by providing a different timeout value. For example, the following code increases the timeout value to 60 seconds:

window.AcquiaLift.loadTimeout = 60;

Tracking script

Acquia Lift users can add a tracking script to a webpage to capture this information. To do this, the tracking script uses the _tcaq.push function to send the page view information to the Acquia Lift service.

This function allows you to perform the following actions:

Capturing a page view

To capture a page view, add the following JavaScript code to your webpage:

<script type="text/javascript">
  _tcaq.push(['capture', 'Content View']);
</script>

Acquia Lift captures the page view and associates it with the website visitor's information.

Capturing additional page view information

The capture method includes several parameters that you can use to include additional information about the webpage or the website visitor:

_tcaq.push(['capture', '<category>', {'<parameter>':<value>'}]);

Capturing do_not_track information

Acquia Lift provides the ability to set do_not_track information for a user. The capture API (POST call) allows the user to send a capture while indicating whether or not the visitor should be tracked. The capture must use the following event_name: updatePersonTracking. For example:

{
  "identity": "qa_5373_2016-12-01 13:21:[email protected]",
  "identity_source": "email",
  "do_not_track": true,
  "return_segments": true,
  "captures": [
    {
      "event_source": "app",
      "event_name": "updatePersonTracking",
      "event_date": "2016-11-24 13:21:57.418",
      "engagement_score": 0
    }
  ]
}

Passing custom events through the JavaScript API

To use custom events with Acquia Lift, create an event in Profile Manager.

You can then pass the event to the Acquia Lift service by using the following JavaScript command:

<script type="text/javascript">
_tcaq.push(['capture', '[event_name]']);
</script>

where [event_name] is either the name of the event that you created.

Drupal taxonomy mappings

You can use Drupal taxonomy terms in your page capture by ensuring that you have mapping fields set to taxonomy vocabularies in your Acquia Lift-enabled Drupal website. These can be set in the Acquia Lift settings, under Configuration > Acquia Lift, in the Data collection settings section.

Contact supportStill need assistance? Contact Acquia Support