I have built an email which generates links for the user using AMPScript as follows:

VAR @BuildingName, @BuildingURL

// additional logic to get correct building

SET @BuildingName = LOOKUP("building","name", "building_id", @BuildingID)
SET @BuildingURL = LOOKUP("building","url", "building_id", @BuildingID)


<a href="%%=v(@BuildingURL)=%%">%%=v(@BuildingName)=%%</a>

When delivering a test send, if "Track all links in this email" is not select the link is generated correctly and works.

If "Track all links in this email" is selected my URL is wrapped with tracking url click.mysite-email.com (which is expected) but the link no longer works as it now links to click.mysite-email.com/%%=v(@BuildingURL)=%%

It displays the variable name wrapped in AMPScript tags which obviously leads to a bad request page. Can someone explain why this happens and how to display the correct link?

1 Answer 1


If you want the links wrapped properly, you should be using the redirectto() function around your URL variable.

<a href="%%=redirectto(@BuildingURL)=%%">%%=v(@BuildingName)=%%</a>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .