The Question(s):
- Does RedirectTo has to be Inline to work properly?
- Can RedirectTo be somehow used in AMP-Script Blocks to work as a variable?
My experiment ;D
Works
Inside a ContentBlock in the e-Mail:
Do you want to have a <u><a alias="Cookie" conversion="false" data-linkto="cloudpageslandingpage" href="%%=RedirectTo(CloudPagesURL(404))=%%" style="text-decoration:none;color:#FFFFFF;" title="Cookie">cookie</a></u>?
Works too
%%[
set @cookie_url = CloudpagesURL(404)
]%%
Do you want to have a <u><a alias="Cookie" conversion="false" data-linkto="cloudpageslandingpage" href="%%=RedirectTo(@cookie_url)=%%" style="text-decoration:none;color:#FFFFFF;" title="Cookie">cookie</a></u>?
So this is just an inline call of redirectto and a cloudpagesurl function
Does not work
%%[
set @cookie_alias = "Cookie"
set @cookie_href = RedirectTo(CloudPagesURL(404))
set @cookie_line = Concat("Do you want to have a ",'<a alias="',@cookie_alias,'" conversion="false" data-linkto="cloudpageslandingpage" href="',@cookie_href,'" style="color:#FFFFFF;text-decoration:none;font-weight : bold; " title="cookie">cookie</a>',"?")
]%%
%%=v(@cookie_line)=%%
Does not work either
%%[
set @cookie_alias = "Cookie"
set @cookie_href = RedirectTo(CloudPagesURL(404))
]%%
Do you want to have a <u><a alias="Cookie" conversion="false" data-linkto="cloudpageslandingpage" href="%%=v(@cookie_href)=%%" style="text-decoration:none;color:#FFFFFF;" title="Cookie">cookie</a></u>?
Tried other variations where the RedirectTo function is not inline in the email itself and each time the links will not be tracked inside the tracking tab when doing so.