Information for: DEVELOPERS   PARTNERS

Update visitor attributes with Google Tag Manager

The following example updates a visitor profile attribute with whether the visitor is a member of your website. Although not comprehensive, the example’s acceptance criteria has two parts:

  • The user has clicked on a link from your Drupal website with the URL /user within it (the default route within Drupal for users to login).
  • You can segment those users in Personalization.

Requirements

  • The website has Personalization installed.
  • The website has Google Tag Manager installed.
  • The website has a menu at the top with the User link, and the URL displays /user.

Create the visitor attribute to track in Personalization

  1. Sign in to Personalization as an administrative user.
  2. Go to Configure > Column Meta Data > Add new column metadata.
  3. Fill out the form with the following information, leaving the rest as default.
    • Display Name: Membership status
    • Display Order: 1
    • Table: Person
    • Accessor: custom_field_4
    • Type: String
    • Check Is Visible In Person Detail
    • Description: Membership status collected for the user
    • Operators: Matches and contains
    • Category: Person properties
    • Check Ignore Case When Comparing
  4. From the bottom of the form, save the new column metadata.

Create a trigger in Google Tag Manager

  1. Sign in to your Google Tag Manager account.

  2. Click Triggers.

  3. Click New.

  4. Name the trigger Login Click.

  5. Enter the trigger type: Clicks - Just Links.

  6. Configure This trigger fires on to Some Link Clicks.

  7. Under Fire this trigger when an Event occurs and all of these conditions are true, configure the variable to an auto-event variable using the Element URL containing user. You must create the auto-event variable.

  8. Save the Login Click trigger. Your trigger configuration displays like the following screenshot:

    lift-gtm-login-click

Create the tag in Google Tag Manager

  1. Create a new tag titled Personalization - Update Person - Membership Status.
  2. Add an Personalization Capture Tag.
  3. Select the Capture type as Update Person.
  4. In the Update Person Custom Parameters expandable section enter person_udf4 as the parameter name and true as the parameter value.
  5. Add the LC - Login Link trigger as the trigger for the tag.
  6. Click Save to use this tag update visitor attributes.