background shape
background shape

Switch off tracking for a link in salesforce marketing cloud

If you ever was wondering how to switch tracking for one link in particular in salesforce marketing cloud here is how we can achieve that using simple AMPScript trick.

You may ask, why would I do that and risk losing precious clicks? In our case, it was a couple of things that, at the client side, caused the link to not show the intended content. We were using hashtags to auto-scroll the user to a specific section of the page. And, as you might know, hashtags (also called fragments) have to come after any query parameters in a URL. This is because everything after the # in a URL is treated as a fragment identifier, which is processed by the browser and not sent to the server. If a hashtag appears before query parameters, the browser will not recognize the query parameters properly, leading to unexpected behavior. However, the platform also had global settings that added query parameters to every link.

The quick and dirty solution, in my opinion, was to switch off link tracking so the auto-append of query parameters wouldn’t occur. This involved a couple of rounds of try-catch debugging and plenty of Googling before we finally arrived at a working solution.

Remember the httpgetwrap and how to track link defined in the script ? Yes, indeed this is the quick and dirty solution to this.

%%[
SET @urlHtml = '<a href="%=v(@somelink_with_queryPramms_and_hashtag)=%"> 
  Hello I\'m hashtag link and won\'t tell anybody you clicked on me
</a>'
]%%
%%=TreatAsContent(@urlHtml)=%%

If you know official solution or there is some simple attribute that simply switches off tracking let me know in the comments.

I found official documentation on how to prevent adding WAC parameters, with the side effect of switching off tracking.

WAC Parameters with Query Parameters in Google Analytics (GA)

WAC parameters are not a standard term in Google Analytics or general web tracking, but they may refer to Web Analytics Campaign parameters or be specific to a platform you’re using.

I also found a question stating that tracking needs to be turned off when working with hashtags and redirectTo().

Oh hi there 👋
I have a FREE e-book for you.

Sign up now to get an in-depth analysis of Adobe and Salesforce Marketing Clouds!

We don’t spam! Read our privacy policy for more info.

Share With Others

MarTech consultant

Marcel Szimonisz

Marcel Szimonisz

I specialize in solving problems, automating processes, and driving innovation through major marketing automation platforms.

Buy me a coffee