Information for: DEVELOPERS   PARTNERS

updatePerson - Acquia Lift JavaScript API

Acquia Lift uses the updatePerson API function to update user-defined Person attributes without creating an Event record or updating the Touch record. The API function can be helpful when there is data from another source you want to append to the person profile, such as firmographic or demographic data. You can provide descriptive names for the attributes in Acquia Lift Web, which are then displayed in the visitor profile summary and the segment builder, using the Content metadata page.

Capturing person attributes

Add the following code to your webpage:

<script type="text/javascript">
_tcaq.push( ['updatePerson',
{'person_udf5':'attributedata1', 'person_udf6':'attributedata2', 'person_udf7': 'attributedata3' }
] );
</script>

where person_udf is a user-defined field for a person and attributedata is the information to add to the person. You can define up to 50 fields for values.

Acquia Lift captures the fields and associates them with the website visitor’s information.

When using an attribute containing a date, the date must display in the following format:

yyyy-MM-dd'T'HH:mm:ss.SSS'Z

For example:

2015-03-25T00:00:00.000Z

Example usage

The following example sets user-defined fields 5, 6, and 7 to firmographic values associated with the business the person works for—the company SMB, categorized as Retail, with 0-50 employees:

<script type="text/javascript">
_tcaq.push( ['updatePerson',
{'person_udf5':'SMB', 'person_udf6':'Retail', 'person_udf7': '0-50 employees' }
] );
</script>

Creating an updatePerson event with Google Tag Manager

You must track whether a user is a member of your website. Although not comprehensive, the 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 Acquia Lift.

Requirements

  • The website has Acquia Lift 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 custom column metadata

  1. Sign in to your website as an administrative user.
  2. Go to Admin > Manage Configuration Data > Custom Column Metadata > Add new column metadata.
  3. Fill out the form with the following information, leaving the rest as default.
    • Display Name – Membership status
    • Display Order1
    • Table – Person
    • Accessorcustom_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.
  5. The new column metadata displays in the form as shown in the following screenshot:

Custom 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. From 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 will display like the following screenshot:

Login Click Trigger

Create a tag in Google Tag Manager

  1. Sign in to your Google Tag Manager account.

  2. Click Tags.

  3. Click New.

  4. Name the tag Update Person.

  5. Add a Custom HTML Tag.

  6. From the HTML tag editor, paste the following script:

    <script>
    _tcaq.push(['updatePerson', {'person_udf4':'True'}]);
    </script>
    

    Note

    The updatePerson tag can use any Lift API method.

  7. Under Triggering, click the checkbox and associate the Login Click trigger with the Update Person tag.

  8. Save the Update Person tag to display like the following screenshot:

Update Person Tag

Test the tag in Google Tag Manager

  1. Sign in to your Google Tag Manager account.
  2. Click Preview.
  3. Open your website where you will see the Google Tag Manager preview in the window.
  4. From the menu, Command click the /user login link which will open the login link in a new tab, leaving your Google Tag Manager preview intact.
  5. The Update Person tag will have fired, and will display in the Google Tag Manager Summary section under Tags Fired On This Page, as shown in the following screenshot:

Tags Fired On This Page

Test Acquia Lift received the data

  1. Before logging into Acquia Lift, grab the Acquia Lift tracking ID from your browser cookies.
    • In Chrome, you can Inspect, and then open Application > Cookies.
    • From Cookies, copy the tc_ptid for your website URL.
  2. Sign in to Profile Manager, and from the People search field, paste the cookie tracking ID from the preceding step.
  3. Click your user, and open the Profile Details screen.
  4. You will see the Property Membership Status with a value of True for your user, as displayed in the following screenshot:

Membership Status True

You have now created Custom Column Meta Data in Acquia Lift, and have effectively used the Acquia Lift JavaScript API to capture added data.