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 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
Sign in to Personalization as an administrative user.
Go to Configure > Column Meta Data > Add new column metadata.
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
From the bottom of the form, save the new column metadata.
Create a trigger in Google Tag Manager
Sign in to your Google Tag Manager account.
Click Triggers.
Click New.
Name the trigger
Login Click
.Enter the trigger type:
Clicks - Just Links
.Configure This trigger fires on to Some Link Clicks.
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.
Save the Login Click trigger. Your trigger configuration displays like the following screenshot:
Create the tag in Google Tag Manager
Create a new tag titled Personalization - Update Person - Membership Status.
Add an Personalization Capture Tag.
Select the Capture type as Update Person.
In the Update Person Custom Parameters expandable section enter
person_udf4
as the parameter name and true as the parameter value.Add the LC - Login Link trigger as the trigger for the tag.
Click Save to use this tag update visitor attributes.