Expressions Replaced by Adobe Target Server

Avatar

Avatar

kaio61751785

Avatar

kaio61751785

kaio61751785

30-12-2020

Using Form Composer we are attempting to use Template Literals as part of our code. But the expressions are being removed by Adobe Target's servers and never make it to the DOM.

 

Is there a way to tell Adobe Target not to make any server side substitutions?

 

Code we have got in a HTML offer, also tried to use backslashes to stop adobe server substitutions;

<script>
	let myText = 'The Text!';
	let theData = {
		moreText: 'This is more text!'
	};

	console.log(`\${myText}`);
	console.log(`${myText}`);
	console.log(`\\${myText}`);

	console.log(`${theData.moreText}`);
	console.log(`${theData.moreText}`);
	console.log(`\\${theData.moreText}`);

	console.log(`${theData['moreText']}`);
	console.log(`${theData['moreText']}`);
	console.log(`\\${theData['moreText']}`);
</script>

 

Screenshot of what gets injected into the HEAD by Adobe Target when preview link is loaded;

Screen Shot 2020-12-30 at 15.19.58.png

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar

ryanr7

Avatar

ryanr7

ryanr7

05-01-2021

Hi @kaio61751785,

This is a good question! That syntax is used by Target for dynamic data in offers which is why it's getting removed/replaced. I couldn't find any info on how to "escape" the format for a literal print. However, I was able to hack a solution that worked for me you might try.

  • Create a profile script that returns the string you want returned like:

 

return "${myText}";​

 

 

ryanr7_0-1609893499031.png

 

  • Use the dynamic data sytax in your HTML offer to replace content with the value of your new profile script (I named mine "static").
    • HTML in offer example:

 

<script>
  let myText = 'The Text!';
  console.log(`${user.static}`);
</script>

 

 

When I run this my response from Target returns this:

ryanr7_1-1609893543052.png

And I see "The Text!" printed to the console. There may still be a better way to do this. But maybe this will help you out until you find the better way.