Print this page

A dynamic URL returns "Page Not Found" error when it is sent in the body of an email from Marketing Cloud

Knowledge Article Number 000213682
Description
You can personalize a URL to pass the subscriber information stored in Marketing Cloud to your landing page at your website. You can use it to pre-load fields on the page or for site tracking purposes.  When it is appended to other static text, a personalization string that is used to personalize a URL does not process correctly before the link is wrapped for tracking. This results in an invalid URL being used for the link.
Resolution
To correct this issue, the link must be created and referenced using AMPscript.  
 

Create a dynamic URL in the email body


Example Attributes: 
 
Function
    Example
 DynURL
     http://www.someurl.com
TrackingParams
     &linkid=1234556


1. Open your AMPscript code block and create a variable to hold the complete URL.
More information on variables can be found in the Keywords section of the AMPscript Syntax Guide.
 
%%[
VAR @url

2. Using personalization and the Concat() function, combine the static text with the URL from the Attribute, and close the AMPscript code block.
SET @url = concat(DynURL,"/offer.html?source=email",TrackingParams)
]%%

3. Using HTML and the RedirectTo() function, build your URL by referencing the variable from step 1 in the body of the email where the link should be located.
<p>This is the link:<br>
<a href="%%=RedirectTo(@url)=%%">Click Here</a>
</p></div></body></html>

When you're done, your AMPscript code will look like this:
 
<html><body><div>
%%[ 
VAR @url
SET @url = concat(DynURL,"/offer.html?source=email",TrackingParams)
]%%

<p>This is the link:<br>
<a href="%%=RedirectTo(@url)=%%">Click Here</a>
</p></div></body></html>

 

Related topics

AMPscript
Getting Started With AMPscript
AMPscript Syntax Guide
AMPscript Functions




promote demote