0

I have created a landing page via cloud pages in web studio,

The below HTML code I have added in the email to redirect to the appropriate cloud page.

The use case is that if the date is expired ,it should redirect to the fallback link. The below code is mentioned in the email html block:

<p>
  <a href="%%=RedirectTo(CloudPagesURL(369, 'ExpirationDate', '2019-11-03', 'Destination', 'https://fe8d1372776d05797c.pub.s7.sfmc-content.com/bmkthfudxk1','Fallback','https://fe8d1372776d05797c.pub.s7.sfmc-content.com/ljvcyngy20r'))=%%" alias="Link to somewhere">
Take me there
</a>
</p>

I have mentioned the below code as it is in the landing page html block:

%%[
    SET @FormattedExpirationDate = Format(@ExpirationDate, "yyyy-MM-dd")
    SET @Today = Format(Now(), "yyyy-MM-dd")
    IF (DateDiff(@FormattedExpirationDate,@Today,'D')<0) THEN
    Redirect(@Destination)
    ELSE
    Redirect(@Fallback)
    ENDIF    
]%%

but it is not working.

I have also tried the below code in landing page html block:

Still not working.

Also in addition to this, I have to configure the expiration date, not as a static one but a dynamic one through data extension. How can it be done?

when not using the code under landing page,the link is directed to the 1st url mentioned.

I want that to be redirected to another link once the date has been expired.

This to be done first via static way by mentioning the date, and second via dynamic way (using Data extension)

  • 2
    At first, make sure that you get the parameters that you are passing to your cloud page. I guess you are missing a RequestParameter() or maybe in that case QueryParamter() function. Furthermore, if you want to be able to get the subsriberkey and stuff in your destination url, you should pass the page id, instead of the whole url and then use CloudPagesURL again. – DonL Dec 2 '19 at 12:36

Your Answer

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

Browse other questions tagged or ask your own question.