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.
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).
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.
Passing parameters with CloudPagesURL is very easy. Just follow the page’s id with one or multiple key value pairs separated by a comma.
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.
%%[ Redirect(CONCAT(CloudPagesURL(1234,'color','blue'))) ]%%
Have I missed anything?
Please poke me with a sharp comment below or use the contact form.