Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

HTML Offer escaping Javascript

Avatar

Level 1

I'm trying to set up a new Experience in Target Premium that uses an HTML offer. 

However, the script tag and javascript is being escaped. How can I prevent this? I have read in multiple places that it is possible to use javascript inside an HTML offer. 

Here's the code I am inserting into the html offer:

<script type="text/javascript"> var jvUser = "returning"; </script>

Here's the code that is rendering on our page:

var mboxCurrent=mboxFactories.get('default').get('target-global-mbox',0);mboxCurrent.setEventTime('include.start');document.write('<div style="visibility: hidden; display: none" id="mboxImported-default-target-global-mbox-0">');document.write('<!-- Offer Id: 100474  --><script type=\"text\/javascript\">\nvar jvUser = \'returning\';\n<\/script>');document.write('<!-- Offer Id: 9024  --><script type=\"text\/javascript\">window.ttMETA=(typeof(window.ttMETA)!=\'undefined\')?window.ttMETA:[];window.ttMETA.push({\'mbox\':\'target-global-mbox\',\'campaign\':\'Gabe\'s Test Experience\',\'experience\':\'Experience B\',\'offer\':\'Set Returning User Var1438712143868-1438712144015\'});window.ttMBX=function(x){var mbxList=[];for(i=0;i<ttMETA.length;i++){if(ttMETA[i].mbox==x.getName()){mbxList.push(ttMETA[i])}}return mbxList[x.getId()]}<\/script>');document.write('</div>');mboxCurrent.setEventTime('include.end');mboxFactories.get('default').get('target-global-mbox',0).loaded();
1 Accepted Solution

Avatar

Correct answer by
Employee

Hi There,

Thanks for reaching out to Adobe Community.

If you are using the Visual Experience Composer then please follow the steps in the below troubleshooting article and see if it helps:

https://marketing.adobe.com/resources/help/en_US/target/target/r_troubleshoot_composer.html

If you are still experiencing the issue then kindly update.

Thanks!

View solution in original post

0 Replies

Avatar

Correct answer by
Employee

Hi There,

Thanks for reaching out to Adobe Community.

If you are using the Visual Experience Composer then please follow the steps in the below troubleshooting article and see if it helps:

https://marketing.adobe.com/resources/help/en_US/target/target/r_troubleshoot_composer.html

If you are still experiencing the issue then kindly update.

Thanks!

Avatar

Level 1

Shekhar_Dhiman wrote...

Hi There,

Thanks for reaching out to Adobe Community.

If you are using the Visual Experience Composer then please follow the steps in the below troubleshooting article and see if it helps:

https://marketing.adobe.com/resources/help/en_US/target/target/r_troubleshoot_composer.html

If you are still experiencing the issue then kindly update.

Thanks!

 

thanks for answer

Avatar

Level 3

@Shekar - I am using form based method in Target Premium. 

<script type="text/javascript" src="http://abc.com/script.js"></script>

Even tried manually appending a script tag to document head, did not help:

<script type="text/javascript">
var script = document.createElement( 'script' );
script.type = 'text/javascript';
script.src = "http://abc.com/script.js";
$("head").append( script );
</script>

 

CSS references work fine. How can I make this work? Please help!

Avatar

Level 10

Hi , 

We tried to replicate your issue at our end on our website but at our end Javascript code inside HTML offer is working fine. Please refer the below screenshot for more details :

Also , Please share your Target Account credentials as well as the client code for Target account in a private message so that we can further debug the issue . 

Thanks & Regards

Parit Mittal