Adobe Campaign UTM parameter personalization block breaking | Community
Skip to main content
david--garcia
Level 10
November 12, 2021
Solved

Adobe Campaign UTM parameter personalization block breaking

  • November 12, 2021
  • 1 reply
  • 2226 views

Given the following personalization block code

 

 

 

?utm_source=newsletter&utm_medium=email&utm_campaign=unitedkingdom-bau&utm_content=newsletter_<%=formatDate(new Date(), '%Bl_%Y').toLowerCase()+formatDate(new Date(), '-professionalDate%2D/%2M/%4Y')%>

 

 

 

 If I execute that in a workflow to construct URL i get the following which is correct

 

?utm_source=newsletter&utm_medium=email&utm_campaign=unitedkingdom-bau&utm_content=newsletter_november_2021-professionalDate12/11/2021

 

 

 

However, after campaign encrypts the URL for tracking it breaks the url

 

 

https://localhost/r/?id=h71eff9,1696def,ca58eb&p1=&p2=november_2021-professionalDate12/11/2021&p3=

 

 

 

In the delivery template, the actual url looks like the following

 

 

 

https://www.somedomain.com/uk/wealth-management/insights/talking-points/why-the-worlds-wealthy-are-still-buying-homes-in-london/<%@ include view="UTM_newsletter" %>

 

 

 

 

 

I tried using escapeUrl but doesnt seem to work, any hints?

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by david--garcia

I've changed my approach given the issues faced with using personalization blocks and now everything is working correctly. Given that I still required a centralized repo, I used platform options to store the utm logic

 

And since my templates were being generated on the back of an API call using content templates, I decided to execute the logic stored as string on the platform options in during the generation of the publication template.

 

  var x =  getOption("utm_privateclients");
  var utm = Function('return '+x)();  

and now the utm structure is appended to the link of the article at the point of generating the delivery template and no need for personalization block this way

and in my javascript template i just use the content link without adding the personalization block anymore

 

1 reply

LaurentLam
Level 5
November 12, 2021

Hi David,
Could you create a variable in your personalization block like:

var UTM="?utm_source=newsletter&utm_medium=email&utm_campaign=unitedkingdom-bau&utm_content=newsletter_november_2021-professionalDate12/11/2021";

and then include it in your delivery but calling the URL like this:

 

https://www.somedomain.com/uk/wealth-management/insights/talking-points/why-the-worlds-wealthy-are-still-buying-homes-in-london/<%= UTM %>

 


Normally you should have all the variable content in the P1 parameter

david--garcia
Level 10
November 12, 2021

Thanks Laurem, I'll try it in a second,

 

Here is what I noticed, so my personalization block is escaping the url correctly and If I enter it in the browser it works.

 

https://www.somelink.com/uk/financial-adviser/insights/strategy-and-economics/what-analysing-language-tells-us-about-inflation/?utm_source=newsletter&utm_medium=email&utm_campaign=bau&utm_content=newsletter_november_2021-newsletterDate12%2F11%2F2021

 

But when I send it through campaign and acc encrypts the url with the tracking/redir it totally breaks.

 

it ends up like https://mydomainhere.adobe-campaign.com/r/?id=h71ff98,1697242,ca59fa&p1=&p2=november_2021-professionalDate12%2F11%2F2021&p3=

 

Here is my personalization block example

<% if (targetData.segmentCode == 'uk1') {%>?utm_source=newsletter&utm_medium=email&utm_campaign=dummy-unitedkingdom-bau&utm_content=professional_advisers_newsletter_<%=escapeUrl(formatDate(new Date(), '%Bl_%Y').toLowerCase()+formatDate(new Date(), '-professionalDate%2D/%2M/%4Y'))%> <% } else if (targetData.segmentCode == 'uk2') {%>?utm_source=newsletter&utm_medium=email&utm_campaign=dummy-unitedkingdom-bau&utm_content=dfm_newsletter_<%=escapeUrl(formatDate(new Date(), '%Bl_%Y').toLowerCase()+formatDate(new Date(), '-ifaDate%2D/%2M/%4Y'))%> <% } else if (targetData.segmentCode == 'uk3') {%>?utm_source=newsletter&utm_medium=email&utm_campaign=dummy-unitedkingdom-bau&utm_content=private_clients_newsletter_<%=escapeUrl(formatDate(new Date(), '%Bl_%Y').toLowerCase()+formatDate(new Date(), '-privateclientDate%2D/%2M/%4Y'))%> <% } else if (targetData.segmentCode == 'uk4') {%>?utm_source=newsletter&utm_medium=email&utm_campaign=dummy-unitedkingdom-bau&utm_content=charity_newsletter_<%=escapeUrl(formatDate(new Date(), '%Bl_%Y').toLowerCase()+formatDate(new Date(), '-charityDate%2D/%2M/%4Y'))%> <% } else if (targetData.segmentCode == 'uk5') {%>?utm_source=newsletter&utm_medium=email&utm_campaign=dummy-channelislands-bau&utm_content=channel_islands_newsletter_<%=escapeUrl(formatDate(new Date(), '%Bl_%Y').toLowerCase()+formatDate(new Date(), '-privateclientDate%2D/%2M/%4Y'))%> <% } else if (targetData.segmentCode == 'uk6') {%>?utm_source=newsletter&utm_medium=email&utm_campaign=dummywealth-global-bau&utm_content=swusl_newsletter_<%=escapeUrl(formatDate(new Date(), '%Bl_%Y').toLowerCase()+formatDate(new Date(), '-swuslDate%2D/%2M/%4Y'))%> <% } else { %>?utm_source=newsletter&utm_medium=email&utm_campaign=bau&utm_content=newsletter_<%=escapeUrl(formatDate(new Date(), '%Bl_%Y').toLowerCase()+formatDate(new Date(), '-newsletterDate%2D/%2M/%4Y'))%> <% } %>