Expand my Community achievements bar.

SOLVED

Dynamic content in a url

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 2

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. 

View solution in original post

8 Replies

Avatar

Community Advisor

Hi @Dnelson_WG ,

 Personalizing URLs - This document will guide to personalize the URL

Regards,

ParthaSarathy S

Avatar

Level 2

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?

 

Avatar

Level 2

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').

Avatar

Employee Advisor

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

Avatar

Level 2

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

Avatar

Employee Advisor

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?

Avatar

Level 2

Thanks for asking, @ramon_bisswanger !

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.

Avatar

Correct answer by
Level 2

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.