Use AMPscript to Create Dynamic Link Aliases

When you send an HTML email that includes a link, you can add an optional alias attribute to your links to help identify the link in your reporting metrics. This feature is helpful if a message contains two links with the same link text and different URLs, or two links with the different link text and the same URL. By providing a link alias, you can easily determine how many users clicked each link.

To use aliases, add the alias attribute to the HTML anchor (a) tag. The contents of the alias attribute aren’t visible to the recipients of your messages.

You can use AMPscript to create dynamic link aliases. This capability is only available in HTML emails. This example tracks link clicks by each subscriber’s region.

In this example, when you view the engagement metrics for the email, you see separate click metrics for each of the Region values for the customers that you sent the message to. For example, you see separate click metrics, such as West Region or South Region. This capability is useful for understanding how customers with different attributes interact with your messages.

When you use dynamic link aliases, there’s a limit of 100 alias names. If you exceed this limit, the excess aliases are grouped with a common name in your metrics.

Aliases on links inside an impression region aren’t recorded in click data. To track per-link aliases, place the link outside any impression region.

Dynamic content blocks add impression regions automatically. To keep alias tracking when you need dynamic content, insert the block with ContentBlockByName(), ContentBlockByKey(), or ContentBlockById() instead of a dynamic content block.

If you use the Web Analytics Connector, dynamic alias values can appear URL-encoded in metrics rather than substituted. This happens because URL encoding can run before AMPscript substitution. If you confirm this is the cause, file a Salesforce Customer Support case to review your account’s link parameter encoding settings.

As a self-service workaround, hard code the alias to a static string, or build the dynamic value into the href URL.