This article outlines best practices for building templates that run optimally on your website.
Campaign Stats Tracking
If you would like to track campaign stats with Marketing Cloud Personalization, use the data attributes (data-evg-*) in the Handlebars HTML. Note that using these data attributes requires the Campaign Stat Tracking gear installed and enabled for your dataset.
Depending on the SDK namespace you’re using, use SalesforceInteractions.DisplayUtils.pageElementLoaded or Evergage.DisplayUtils.pageElementLoaded to defer rendering of your template until the content zone or target element has loaded on the webpage. Note that this method requires the Display Utilities gear installed and enabled for your dataset.
In order to prevent “flicker” (where the original website content appears briefly before being replaced by the template), the apply function in the Client-side Code must return a Promise that resolves when the template renders. Note that the Flicker Defender gear must also be installed and enabled for your dataset.
Develop templates with accessibility in mind. To provide access to individuals who use assistive technologies like screen readers, ensure that your template is compliant with Web Content Accessibility Guidelines (WCAG).
Develop your template to be compatible across different browsers as needed. Click the “Test” button in the template editor to test your template on your website in a new separate browser window.