1

I'm trying to bypass tracking on a single link within an email. I know this can be done by building the link with ampscript. I've gotten it to work if I have a static url like this:

%%[
var @myLink
set @myLink = Base64Encode('<a href="http://link.com">click here</a>')
]%%

%%=Base64Decode(@myLink)=%%

However, I have a data extension with a bunch of promo codes that I need to load into the url like http://link.com/%%CUSTOMCODE%%.

I can't seem to get this working. I've tried a CONCAT but it isn't working. Example:

%%[
VAR @myLink, @comboLink

SET @myLink = my_link_from_data_extension
SET @comboLink = CONCAT('<a href="', @myLink, '"><a>')
]%%

%%=v(@comboLink)=%%

Any tips? How do I insert a field from a data extension when I am building this URL? So confused.

4

Firstly, you shouldn't need to go through the effort of encoding and decoding your URL.

The following link will not be tracked:

%%[
var @myLink
set @myLink = 'http://link.com'
]%%

<a href="%%=v(@myLink)=%%">click here</a>

And the following link will be tracked:

%%[
var @myLink
set @myLink = 'http://link.com'
]%%

<a href="%%=RedirectTo(@myLink)=%%">click here</a>

Now, to answer your question, you should just simply need to write:

%%[
var @myLink, @promoCode, @comboLink
set @myLink = 'http://link.com'
set @promoCode = CUSTOMCODE
set @comboLink = Concat(@myLink, '/', @promoCode)
]%%

<a href="%%=v(@comboLink)=%%">click here</a>

This assumes that you have a field named 'CUSTOMCODE' in your sendable data extension (which contains a respective promotional code for each Subscriber).

  • Hi Eliot, thanks so much for the helpful advice. When I tested what you sent, it works in preview, the URL builds properly, but when I do an actual send with it, the URL is wrapped in tracking and when I click it doesn't resolve, it goes to: ourCustomSFMCurl.com/%%=v(@comboLink)=%%. So, not only is it wrapped in tracking, it isn't even resolving. Very strange. Especially strange since it works fine when I preview it with the same data extension I sent to. – Peachy Jul 11 '18 at 14:37
  • After a little testing, I think the issue might be that the the <a href""></a> has to be in the ampscript to avoid SFMC rewriting the URL. – Peachy Jul 11 '18 at 15:04
  • I was able to get it working by putting the href into the concat statement, rather than hard coding it into the email. – Peachy Jul 11 '18 at 15:18
  • @Peachy that's good to hear that you have resolved this. Please can you post your solution as a new answer, and accept it for the benefit of others. Thanks! – Eliot Harper Jul 11 '18 at 21:22
0

To get this to work, I took Eliot's suggestion and tweaked it slightly. When the is hardcoded into the email, SFMC overwrites it with their tracking. If you pull the href into the ampscript, it is no longer tracked. This is what worked:

%%[
var @myLink, @comboLink
set @myLink = my_url
set @comboLink = Concat('href="',  @myLink, '"')
]%%

<a %%=v(@comboLink)=%%>Link</a>

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.