Dynamic content in a url | Community
Skip to main content
Level 2
November 21, 2022
Solved

Dynamic content in a url

  • November 21, 2022
  • 3 replies
  • 3332 views

I'd like to create a content block that my users can use to change their base urls according to the profile's state but I can't quite get there.

If context.profile.location.stateCode = AL

then www.domain.com/al

else if context.profile.location.stateCode = TX

then www.domain.com/tx

else www.domain.com/

 

I've as far as a good preview but it doesn't work when it gets to the point of assigning the tracking links. If this has already been answered for ACS, I'd love a link to the solution. 

 

Thanks!

-Dave

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 Dnelson_WG

Final follow up to this. I worked with Adobe support and we found that content blocks are not recommended within URLs. It was a nice thought but URL tracking isn't compatible. 

3 replies

ParthaSarathy
Community Advisor
Community Advisor
November 22, 2022

Hi @dnelson_wg ,

 Personalizing URLs - This document will guide to personalize the URL

Regards,

ParthaSarathy S

 ~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups
Level 2
November 22, 2022

Thank you @parthasarathy but what I'm trying to do is write the content block that decides how the URL should be configured. The code below gives the intent but it definately doesn't work.

<% if ( context.profile.location.stateCode = 'AL' ) { %>https://domain.com/al/<% } else if ( context.profile.location.stateCode = 'TN' ) { %>https://domain.com/tn/<% } else { %>https://domain.com/<% } %>

 

Is there a resource for writing custom content blocks?

 

Level 2
November 22, 2022

I got as far as a correct preview with the following content block:

<% var crdomain = context.profile.location.stateCode;if( ['AL'].indexOf (crdomain) >=0 ){crdomain = '/al';} else if( ['TN'].indexOf (crdomain) >=0 ){crdomain = '/tn';}else{crdomain = ''; } document.write(crdomain); %>

 

but preparation failed with this reason:

DLV-490261 Personalizing host in a tracked link requires tracking URL signing ('https://domain.com<% var crdomain = context.profile.location.stateCode;if( ['AL'].indexOf (crdomain) >=0 ){crdomain = '/al';} else if( ['TN'].indexOf (crdomain) >=0 ){crdomain = '/tn';}else{crdomain = ''; } document.write(crdomain); %>/schedule').
Adobe Employee
November 23, 2022

for your content block, you may need to include the trailing / to get it working.

Level 2
November 23, 2022

Great suggestion, @bisswang , that change made it through the preparation stage but then the entire content block was ignored when sent. 

Dnelson_WGAuthorAccepted solution
Level 2
January 5, 2023

Final follow up to this. I worked with Adobe support and we found that content blocks are not recommended within URLs. It was a nice thought but URL tracking isn't compatible.