I am building URLs dynamically using AMPScript and values stored in a data extension. We are using Web Analytics Connector WAC, so the AMPScript vars are not interpreted properly by the WAC when sending the Email. To face this issue I have build all my dynamic urls as explained here (https://gist.github.com/MyCueCards/e72bfbacdc4e6d8405cf9b137a701ecf).

The urls are been built properly and working as expected. My issue now is that using this approach, we are passing over the WAC and the tracking service system is not generating the click.info.xxx/q=token associated url for tracking the clicks.

Is there any way of building the URLs dynamically using AMPSCript vars and having the system genrating the click.info.xxx/token associated url ?

I have been using RedirectTo() in conjunction with treatascontent() functions in any kind of combination but still is not working.

  • Do you have sample code? – Macca Jan 24 '20 at 4:07
  • Hi Macca, please have a look into the link attached. This is my code. Thanks – Enrique Diaz Jan 24 '20 at 12:38

Based on the code you provide, I would recommend doing changes along with what I have done below:

<!-- AMPscript Block -->
var @UTMstring1
set @UTMstring1 = "?utm_source=SFMC&utm_medium=email&utm_campaign="
var @UTMstring2
set @UTMstring2 = "&utm_content="
var @UTMstring3
set @UTMstring3 = "&utm_subscriber="

var @url1
set @url1 = "https://www.salesforce.com/eu/"

var @link1
set @link1 = Concat(@url1,@UTMstring1,emailname_,@UTMstring2,'Hello',@UTMstring3,subscriberid)
set @link1 = URLEncode(@link1)

<!-- snippets within HTML -->

This is the URL: <a href="%%=RedirectTo(@link1)=%%" target="_blank">https://www.salesforce.com/</a>

To summarize: I have removed the href="" from your Concat function, and placed it into the HTML, wrapping RedirectTo() - which is required for the URL click tracking to work on SFMC, when storing URLs in AmpScript variables.

Additionally, I have tested this with WAC appending cm_ven=ExactTarget&cm_cat=%%jobid%% on top of the utm parameters added to the URL in Ampscript.

This results in following URL: https://www.salesforce.com/eu/?utm_source=SFMC&utm_medium=email&utm_campaign=Testers&utm_content=Hello&utm_subscriber=18657090&cm_ven=ExactTarget&cm_cat=20656

And, once sent out, the URL is wrapped in tracking, e.g.:https://cl.s50.exct.net/?qs=0a1b2c3d4e5f6g, and counted. Please observe the tracking URL will not be shown if you just preview the email in "Preview and Test" tab.

  • Hi Lucas, thanks for responding. I have already tried this option you mentioned, but the issue I am having is with the WAC because is not parsing and interpreting the redirectTo() function becuase is detecting the link. So doing something similar to your proposal the links are broken becuase of the WAC interception. This is one example of link result: yyy.es/es-es/sale/c/as80000000/… – Enrique Diaz Jan 24 '20 at 12:41
  • @EnriqueDiaz - please check my updated answer. It does also work with WAC. – Lukas Lunow Jan 24 '20 at 13:09
  • Ok Lukas, let me try then. I will let you know ! – Enrique Diaz Jan 24 '20 at 13:35
  • Hi Lukas, I have already tested. Initially the URL is being build properly, I can see in the Sent Email the click.info.xxx/q=token being built properly, but when clicking into the link, the URL redirection is giving me an error becuase is broken. I copied and paste here the last part of the URL. You can see here: .......&utm_source=sfmc&utm_medium=email&utm_content=20200124_956837_Hero1-ES-ES%22&utm_campaign=AS_Promo_2019-sales2ndwave&utm_source=sfmc&utm_medium=email&utm_content=20200124_956837_%%%3dRedirectTo(%40link1)%3d%% – Enrique Diaz Jan 24 '20 at 13:53
  • @EnriqueDiaz I suspect your WAC acting up. What do you have in there? – Lukas Lunow Jan 24 '20 at 14:00

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.