How to create links and redirects in Marketing Cloud

How to create links and redirects in Marketing Cloud

The matter seems trivial but still requires close attention when passing URL parameters.

Links and URLs

Let’s say we want to create a simple link to a marketing cloud web page.

We then have 2 choices: make an absolute or a relative URL.

It’s ill advised to use an absolute URL, since the domain name or the page link might change with time.

Therefore, using the method CloudPagesURL seems the most appropriate and only requires the id of your page, which can be found in each page’s parameters.

<a href="%%=CloudPagesURL(1234)=%%"></a>

But in case of links in the HTML emails, this method is not enough. As a matter of fact, using CloudPagesURL in the href attribute of an <a> tag will most likely result in a broken link because of the automatically added parameters (such as tracking parameters and so on).

<a href="%%=CloudPagesURL(1234)=%%?color=blue"></a>

To avoid the broken links, please use RedirectTo and Concat method. This will create a proper URL string with every additional parameter and the correct separator.

<a href="%%=RedirectTo(CONCAT(CloudPagesURL(1234),'?color=blue'))=%%"></a>

Passing parameters

Passing parameters with CloudPagesURL is very easy. Just follow the page’s id with one or multiple key value pairs separated by a comma.

<a href="%%=RedirectTo(CONCAT(CloudPagesURL(1234,'color','blue')))=%%"></a>

The best part is that every parameter will get automatically encoded and you don’t have to do it separately yourself with Base64Encode or any other method.

The parameters can then be fetched with a simple RequestParameter method without even decoding them.

	SET @Color = RequestParameter('color')


Not unlike RedirectTo method, Redirect requires Concat to function properly.

Use CloudPagesURL method within just as you did before.


Have I missed anything?

Please poke me with a sharp comment below or use the contact form.

Leave a Reply

Your email address will not be published. Required fields are marked *

Up Next:

How to create a Form Handler and avoid Smart Capture

How to create a Form Handler and avoid Smart Capture