0

I have a content block that pulls in logo based on mcid.

I have a lookup that populates the different MCID's per brand. (this works).

When I preview the email, everything works. When I fire off a test email, the logo displays (ampscript pulls and resolves), but the href is broken because the ampscript doesn't resolve.


I've got this to work by using redirectTo.

My question is

if I have these below, then will I have to set a separate url for each one, and then use RedirectTO?

http://abc.com/password%%=v(@mcid)=%%/
http://abc.com/contact%%=v(@mcid)=%%/
http://abc.com/legal%%=v(@mcid)=%%/
http://abc.com/logo%%=v(@mcid)=%%/
http://abc.com/homepage%%=v(@mcid)=%%/
http://abc.com/promo%%=v(@mcid)=%%/

5
  • Where is the href located ? Aug 23, 2022 at 11:42
  • inside a content block. Ampscript is located inside the html.
    – lyslexic
    Aug 23, 2022 at 11:44
  • Should not abc.com/password%%=v(@mcid)=%% be abc.com/password/%%=v(@mcid)=%% (added a "/" between password and %) ? Aug 23, 2022 at 11:46
  • no, the url is correct. abc.com/password1234/ where 1234 = mcid the problem is that when i preview, i get this which is correct: ttp://abc.com/password1234/ but when i send a test (list or DE), I get this: ttp://abc.com/password%%=v(@mcid)=%%/ the ampscript does not resolve.
    – lyslexic
    Aug 23, 2022 at 11:51
  • Hard to investigate more without AMPScript/HTML actual code. Aug 23, 2022 at 12:00

2 Answers 2

4

It’s best to use a combination of Concat and RedirectTo for this use case:

%%[

var @link, @mcid
set @mcid = AttributeValue("mcid")
set @link = concat("http://abc.com/password", @mcdic)

]%%
Click <a href="%%=RedirectTo(@link)=%%">here</a> for password.

Not sure how you’re retrieving the mcid so I just used the AttributeValue function, you might have to change that part.

And yes, you will have to set every link like that separately.

Source: https://ampscript.guide/redirectto/

0

Preview links often work because they are not wrapped for tracking until send time. RedirectTo specifically is used to designate the link as a link after the dynamic variables have been properly processed rather than before, which can cause redirection issues.

That being said you will need a different RedirectTo function call for each of these links if you are looking to properly wrap these links for tracking. The alternative would be to stop link tracking, either at the email level or for individual links through additional code outlined here https://help.salesforce.com/s/articleView?id=000314602&type=1.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .