Get an attribute name or value by attribute ID

This article provides information on the getAttributeNameById() and getAttributeNameById() methods for the event and vistor objects.

Attribute names can be changed, which can cause problems when code references attributes by name. To avoid problems with attribute names changing, you can reference attributes by ID. Both the event and visitor objects have a getAttributeNameById() and getAttributeValueById() methods that you can use to get an attribute name or value based on its attribute ID. The following example shows how this works.

For example, enter the following in the code editor:


When you enter the opening parenthesis for the method, a list of attributes and associated IDs is displayed, as shown below:


You can enter part of the attribute name to filter the list. When you select an attribute from the list, its ID is added to your code after the opening parenthesis. The list of attributes works the same way for getAttributeValueById().

Was this page helpful?

This page was last updated: January 7, 2023