When you are using a Form based experience Composer to create an experience , you will be definitely choose an mbox which will identify the location on your page where you are trying to deliver content of the experience and Hence the content ( Htrml offer or any thing else) will be delivered to the chosen mbox location. So your guess that AT.js inserts itself in the <HEAD> tags, and HTML content is not supported here doesn't hold good here.
Also, Are you using document.write in the HTML offer ?.Can you please share Adobe Target Account credential & Activity URL in a private message on forum so that we can debug the issue at our end.
You are correct. The at.js fires the global mbox request from the HEAD of the document and so HTML content can't be rendered there. Depending on your use case there should be several options available for adding HTML with the visual composer:
- Use the code editor > custom code section and uncheck the "add to head" option.
- Find an element on the page just above to the place you want to add HTML and choose the insert element option.
The global mbox was designed for the visual composer so you may find those options work better for you. However, if you find that you must use the form composer you have these options available.
- Use global mbox and create an html offer but write a script to insert the HTML content you are trying load directly from the global mbox to somewhere on the body. Keep in mind you'll need to time the execution of your script to be after the DOM element you are manipulating is available.
- Add a regional mbox to the page (this would be in the body around the content you want to change) and then select that mbox in the location dropdown for the form composer. Create an regular HTML offer.
Here's a help doc on adding a regional mbox to your page: mboxCreate(mbox,params)
Thanks for the detailed reply. I think your suggestion to use the global mbox, but write a script to insert the HTML content is my best option here.
I played around with regional mboxes, but there was just too much flashing.
I also want to avoid using the VEC. I have around 150 dynamically generated HTML offers which I'm uploading into Target using the API. When I use VEC to add custom code, I can't select a pre-existing offer, I can only paste in code.
Glad that helped. One other thing that might work for you in the VEC is the swap offer option. If you can select the appropriate div/container on the page that matches the scope of your API uploaded HTML offers you should be able to then pick from the uploaded offer set which one you want to replace the container you selected in the VEC.