---
schema_version: "1"
id: 040bf56817f1ee391e447ac81f0d15a59151057c82a02a1d46554547d5ff2ebd
title: Use AMPscript to Create Dynamic Link Aliases
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/marketing-cloud/ampscript/guide/language-basics/mc-ampscript-guide-language-basics-dynamic-link-aliases.md
canonical_url: https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-dynamic-link-aliases.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 4bc8e74534758eda3661ae9a199393b79b38dc4feae1bc206b54eb6b97c1765e
products:
  - AMPscript for Marketing Cloud
  - Marketing Cloud
---
# 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.

```html
<a href="https://www.example.com/help" alias="Help link top of message">Help</a>
```

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.

```html
<a
  href="http://website.example.com/key/p...ID=C12915x001B"
  target="new"
  alias="%%=CONCAT(Region,' Region')=%%"
></a>
```

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.

## Limitations

### Aliases Inside Impression Regions

Aliases on links inside an [impression region](/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-impression-tracking.html) 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()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-block-by-name.html), [ContentBlockByKey()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-block-by-key.html), or [ContentBlockById()](/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-block-by-id.html) instead of a dynamic content block.

### Web Analytics Connector

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.

```html
<a
  href="http://website.example.com/key/p...ID=C12915x001B&region=%%=CONCAT(Region,'_Region')=%%"
  alias="Regional Promo Link"
></a>
```
