Information for: DEVELOPERS   PARTNERS

Using Google Tag manager with Acquia Lift

When using Acquia Lift, you can use Google Tag Manager to instrument events, which can both provide more understanding, and a better customized experience for your users.

Video: Tracking custom events

The following video provides information regarding implementing custom events.

Creating custom events

Using the following framework (with its own example values), you can build an Acquia Lift event with Google Tag Manager. Modify any of the provided example names as appropriate for your application.

  1. Build an event that can be used for tracking purposes. In this example, we are using an event labeled as Add to Cart.

    1. Create an event.
    2. Enter values in the following fields:
      • Event Name – Example value: Add to Cart
      • Event ID – This should auto-fill with the Event Name, but can be modified
      • Customer Site – Either click the appropriate website, or click Global
      • Event Type – Example value: Click Click
    3. Click Save to save the event.
  2. To map retrieved information to users, you must next Add column metadata for the event to Profile Manager.

    For the column metadata, use the following values:

    • Display NameProduct Name
    • Display Order1
    • TableEvent, for the Event table
    • Accessorcustom_field_1(getCustomField1) (be sure to note the number for this field)
    • TypeString
    • DescriptionProduct name from Add to Cart
  3. Configure the Google Tag Manager to expose the product name in the data layer of your website. Configure a variable in Google Tag Manager to store the product name: product-name. For an explanation of Google Tag Manager configuration, see Tags, triggers, variables, and the data layer.

    Google Tag Manager displaying the variable product-name

    After configuring the variable, create a trigger that fires when a user clicks the Add to Cart button.

    Google Tag Manager adding an add-to-cart trigger for form submissions

  4. Create a custom HTML tag that captures the Add to Cart trigger, using the Acquia Lift JavaScript API method of capturing a page view. To do this, use code similar to the following:

    _tcaq.push(['capture', 'Add to Cart', { 'event_udf1':{{product-name}} }]);

    The event_udf number (event_udf1 in this example) must match the number chosen in the Accessor field mentioned previously. After embedding this code, whenever a user clicks the Add to Cart button on a product page, an event will be returned in Profile Manager as follows:

    Google Tag Manager displaying properties and values of an event in table format

    Other possible uses are to create triggers and events using the captureIdentity or updatePerson API functions.