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
  • 3333 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
December 2, 2022

What do you mean with "ignore"? only a white text rendered or just the static domain.com part?

How does it behave if you open the E-Mail preview in the editor?


Thanks for asking, @bisswang !

I added the content block to the URL and to a regular text element elsewhere in the layout to make sure it is functioning.

- In the preview (profile substitutions), I see the correct links on hover or right-click and open link.

- If I turn tracking off, the correct links make it all the way into my proof emails.

- Only when tracking is enabled, and I send a proof, all the links don't have anything where the content block is:

https://www.domain.com/schedule?utm_ ...

It should be: https://www.domain.com/schedule/al?utm_ ... or: https://www.domain.com/schedule/tn?utm_ ...

I also added "xx" to verify the default condition: https://www.domain.com/schedulexx?utm_ ...

Finally, I created similar logic in my additional data and used a personalization field instead of a content block. That works but I'm trying hard to give our marketers the easiest and most fool-proof way to create their emails.

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.