[SalesForce] How to use a data extension field for a URL with tracking

I am having some trouble with creating a variable URL and getting it to work with the tracking. I have set a field up in my data extension which contains the different URLs. I have then set the following code within the a tag:

<a href="%%FieldName%%" target="_blank"/>

I tested one of the links and it didn't work properly. It took me to a different part of the site I wanted to link to. I then read up to see if anyone's had the same issue and came across the RedirectTo AMPScript found on the following page:

https://code.exacttarget.com/question/tracking-external-link-ampscript-valriables

I tested this but still did not work:

<a href="%%=RedirectTo(FieldName)=%%" target="_blank"/>

Can anyone please tell me what I am doing wrong?

Cheers,
Nathan

Best Answer

That code sample should work.

Can you try the following (just put the field name inside a variable):

%%[
SET @FieldName = FieldName
]%%


<a href="%%=RedirectTo(@FieldName)=%%" target="_blank"/>
Related Topic