Personalization

Capture page events with Google Tag Manager

After adding the Personalization Capture template to your Google Tag Manager workspace you can capture various page events in Personalization.

For an explanation of Google Tag Manager configuration, see Tags, triggers, variables, and the data layer.

Create the event to track in Personalization

Build an event used for tracking purposes. The following example uses an event labeled Add to Cart.

  1. Create an event.

  2. Enter values in the following fields:

    • Event Name: Example value: Add to Cart

    • Event ID: Enter the machine name for the Event Name such as add_to_cart.

    • Customer Site: Click Global.

    • Event Type: Click Other.

  3. Click Save to save the event.

(Optional) Create metadata about the event being captured in Personalization

To map more metadata about the event, you must add column metadata for the event to Personalization. The following example captures the name of the product added as part of the Add to Cart event.

  1. Follow the instructions for Using column meta data.

  2. For the column metadata, use the following values:

    • Display Name: Product Name

    • Display Order: 1

    • Table: Event, for the Event table.

    • Accessor: custom_field_1(getCustomField1) (ensure you note the number for the field)

    • Type: String

    • Description: Product name from Add to Cart

Create the tag in Google Tag Manager

  1. Sign in to Google Tag Manager.

  2. Create a new tag titled Personalization - Event - Add to Cart.

  3. In the tag configuration select the Personalization Capture custom template as your tag type.

  4. In the Capture Type menu, select Event.

  5. Enter add_to_cart as the Event ID. Ensure the Event ID matches the Event ID value generated in Personalization.

  6. To capture the product name in Personalization, map the product name dataLayer variable to the column metadata field (event_udf1) created earlier. In the Event Custom Parameters section, enter the values:

    • Parameter name: event_udf1

    • Parameter value: {{product-name}}

  7. After configuring the tag, you can create a new trigger or select an existing trigger. The following example, creates a new trigger from a form fill.

    For more information on creating a new trigger in Google Tag Manager, see About triggers

  8. Once the fields are mapped and have a trigger set, click Save to save the tag.

The tag will now capture any Add to Cart event on the page the name of the product added to the cart.