Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

The availability of features may depend on your plan type. Contact your Customer Success Manager if you have any questions.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

HTML

How to use the HTML box in the Template Builder for Optimizely Web Experimentation and Optimizely Personalization

You can write the body of the experience template in Optimizely Web Experimentation and Optimizely Personalization in the HTML box. You can write any HTML here and decide where it gets injected in the Apply JS section. Along with vanilla HTML, you can use mustache syntax to add more advanced logic like loops and conditionals.

You can reference field values by using the API name on the extension object like {{ extension.title }}. For nonescaped values like an HTML or rich text field, use triple brackets like {{{ extension.contents }}}.

<div class="banner" style="background-color: {{extension.color}}">
  {{{ extension.text }}}.
  <a href="{{extension.link}}">{{{ extension.link_text }}}</a>
</div>

Next