The AttributeValue function returns the value of a subscriber attribute. This works similar to the RequestParameter function but AttributeValue works with personalization strings (i.e. _subscriberKey). Value cannot be null or empty. A practical use case is on CloudPages and with the CloudPagesURL function.
Example from Email:
For example, you have a link from an email to your CloudPage. We are sending to a subscriber with the subscriber key of “003j000000Tn3su.” Using the CloudPagesURL function, this passes the _subscriberkey value.
< a href="%%=RedirectTo(CloudPagesURL(12345))=%%">Click Here< /a>
Example on CloudPage:
On the CloudPage, we use the AttributeValue function to retrieve the value for _subscriberkey and set it as the @subscriberKey variable.
%%[
set @subscriberKey = AttributeValue(_subscriberKey)
]%%
%%=v(@subscriberKey)=%%
Output:
003j000000Tn3su
Explanation:
The @subscriberKey variable in this example is a ContactId of “003j000000Tn3su” that we sent to in the email. The CloudPage picks up this value from the subscriber using the AttributeValue function and from the CloudPageURL function encrypted string.