Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Adobe Campaign UTM parameter personalization block breaking

David__Garcia
Level 9
Level 9

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?

 

1 Accepted Solution
David__Garcia
Correct answer by
Level 9
Level 9

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

 

David__Garcia_0-1636772876861.png

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)();  

David__Garcia_1-1636773154295.png

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

David__Garcia_2-1636773303362.png

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

David__Garcia_3-1636773424366.png

 

View solution in original post

4 Replies
LaurentLam
Level 6
Level 6

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 9
Level 9

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-languag...

 

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-profession...

 

David__Garcia_0-1636716499588.png

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'))%>
<% } %>

 

David__Garcia
Level 9
Level 9

Hi @LaurentLam 

 

I require the UTM to be constructed dynamically as;

 

<% if (targetData.segmentCode == 'dummy') {%>?utm_source=newsletter&utm_medium=email&utm_campaign=dummy-unitedkingdom-bau&utm_content=dummy_newsletter_<%= formatDate(new Date(), '%Bl_%Y').toLowerCase()+formatDate(new Date(), '-dummyDate%2D/%2M/%4Y') %><%}%>

And from the looks of it, the conditional statements are the ones generates the multiple p1, p2, p3

 

?utm_source=newsletter&utm_medium=email&utm_campaign=dummy-unitedkingdom-bau&utm_content=dummy_newsletter_&p2=november_2021-dummyDate13/11/2021&p3=

 Whereas the following code in the personalization block

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

Renders

https://localhost/r/?id=h726528,169b21b,ca626d&p1=november_2021-professionalDate13/11/2021
?utm_source=newsletter&utm_medium=email&utm_campaign=dummy-unitedkingdom-bau&utm_content=professional_advisers_newsletter_november_2021-professionalDate13%2F11%2F2021

But i need to be able to use conditional statements as this block will be used by multiple campaigns, hence the need for a centralized location where you can control all tags, any ideas?

David__Garcia
Correct answer by
Level 9
Level 9

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

 

David__Garcia_0-1636772876861.png

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)();  

David__Garcia_1-1636773154295.png

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

David__Garcia_2-1636773303362.png

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

David__Garcia_3-1636773424366.png

 

View solution in original post