I'm new to AmpScript and have probably an easy problem related to passing values from email (sendable data extension) to a landing page built in Cloud Pages.

Here's my code in the email:

<a href="%%=RedirectTo(CloudPagesURL(1234, "Id", @id, "Email", @email))=%%">

and them in the Cloud Pages I use the following:

set @subkey = RequestParameter("Id")
set @emailaddr = RequestParameter("Email")


Your id: %%=v(@subkey)=%% and your e-mail address: %%=v(@emailaddr)=%%

However, when I'm clicking on the redirect button in the email I get 500 error. I'm guessing it's an easy fix but somehow anything I do it still doesn't work. Could you please help me see what's wrong with the code above? Thank you!


There are a few things to point out with your anchor tag. Firstly, you're using double quotes in your AMPScript inside the HREF attribute. This will be breaking the HTML. Change the quotations to single quotes to avoid this:

<a alias="My Tracking Alias" href="%%=RedirectTo(CloudPagesURL(1234, 'Id', @id, 'Email', @email))=%%">

If you're using the Web Analytics Connector to automatically append UTM tags and the likes to your URLs, you need to provide some way for WAC to understand there's already a query string in the generated URL. This is to avoid two query strings being appended to your URL - one for the "qs" param holding the context and the other for the WAC parameters:

<a alias="My Tracking Alias" href="%%=RedirectTo(Concat(CloudPagesURL(1234, 'Id', @id, 'Email', @email),'&'))=%%">

Lastly, the CloudPageURL function's useful for passing data to a CloudPage that the page would not normally have knowledge of. The parameters you're passing are essentially the SubscriberKey and EmailAddress. The CloudPage has access to this data in any case through the "Context" provided by the CloudPageURL wrapped link, so passing them explicitly is redundant. The following link would provide the same functionality:

<a alias="My Tracking Alias" href="%%=RedirectTo(Concat(CloudPagesURL(1234),'&'))=%%">

And in your CloudPage, you can use Personalization Strings much like your would in the email:

<!-- Standard Personalization Strings -->
SubKey: %%_SubscriberKey%%<br>
Email: %%emailaddr%%<br>
From Sendable DE - careful as this may
not be available at open time if DE's been cleared
Fame: %%f_name%%

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.