Object

An overview of the Site Wide HTML Object

Object Structure

{
  "location": "BODY",
  "markup": "<script>console.log('hello from site-wide html')</script>"
}
AttributeDescription
locationAn ENUM with the options of: BODY, HEAD, CONTENT_END, BEFORE_SCRIPTS. See note below about using it correctly.
markupThe raw HTML markup you want to be embedded into the website. Make sure to escape properly.

Using location correctly

In most cases, you should use the BODY location. This places your code at the bottom of the page and respects performance best practices. Here are some other best practices for specific locations:

  • BEFORE_SCRIPTS is great if you have a cookie or consent banner, and you need your script to load before any other scripts/trackers/cookies load on the page. Duda has created this specifically to load before scripts, but, after critical visual content. This ensures that content loads as-fast-as-possible and is not blocked by render-blocking scripts.
  • HEAD should be used for meta tags, schema, link tags & other data. Avoid loading anything here that has an src attribute.
  • BODY places the script at the end of the tag of the page.
  • CONTENT_END places the script after visible content, but before native Duda scripts.