acquiaLiftWebSegments - Acquia Lift JavaScript API

The Acquia Lift JavaScript API allows you access to an array of segments that is based on tracking IDs, which can be useful both for analysis with your web analytics product, or if shared with another platform. It can work with any website that is connected to Acquia Lift.

Displaying a segment list

To display a list of segments, modify your website to add JavaScript code that is similar to the following:

drupal_add_js("jQuery(document).bind('acquiaLiftWebSegments', function(event, segments, currentCapture) {
// Do something with segments
});", 'inline');
?>

Example

The following example will return three pop-up alerts, each of which containing one of the following items:

  • The list of segments
  • The current capture, or information about the user who entered these segments
  • The name of the event that triggered this code (in this case, acquiaLiftWebSegments)

<?php
drupal_add_js
("jQuery(document).bind('acquiaLiftWebSegments', function(event, segments, currentCapture) {
if (segments != null) {
var seg = '';
for (i = 0; i < segments.length; i++) {
if (i > 0)
{ seg + ', ' }
seg = seg + segments[i];
}
alert('Segments: ' + seg);
}
alert('Current capture = ' + JSON.stringify(currentCapture));
alert('Event = ' + event.result);
});"
, 'inline');
?>

Contact supportStill need assistance? Contact Acquia Support