Dynamic content in a url | Community
Skip to main content
Level 2
Nov 21, 2022 8:42 PM UTC
Solved

Dynamic content in a url

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.
Dnelson_WGAccepted solution
Level 2
Jan 5, 2023 1:16 PM UTC

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. 

8 replies

Dnelson_WGAuthorAccepted solution
Level 2
Jan 5, 2023 1:16 PM UTC

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. 

Translate
Level 2
Nov 22, 2022 2:16 PM UTC

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').
Translate
Employee
Nov 23, 2022 12:57 PM UTC

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

Translate
Level 2
Nov 23, 2022 2:13 PM UTC

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

Translate
ParthaSarathy
New Participant
Nov 22, 2022 5:41 AM UTC

Hi @dnelson_wg ,

 Personalizing URLs - This document will guide to personalize the URL

Regards,

ParthaSarathy S

Translate
 ~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups
Level 2
Nov 22, 2022 1:23 PM UTC

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?

 

Translate