Menu

Custom code and embeds

At the end of this guide you have code from another service running on your published site: on every page through Custom code, or in one place on a page through the Embed block.

Code on every page

Use this for code a service asks you to place on every page, such as a chat widget.

  1. In your site's dashboard, open Settings, then Custom code.
  2. Paste the code into Head ("Injected at the end of <head> on published pages") or Body ("Injected at the end of <body> on published pages"), as the service's instructions say.
  3. Check the size under each field. Each holds up to 256 KiB; over that, the field says "Over 256 KiB. Shorten this code to save it."
  4. Choose Save changes.
Settings: custom code tab with warning.

The code reaches your live site when you publish the Site settings item from your site's Overview. See Publish changes. It never runs in the editor or in previews, so check it on the published site.

The Embed block

The Embed block places a tool from another service, such as a booking calendar or a map, at one spot on a page, under a short heading. Add it like any of the blocks (the sections of a page): see Add, move and hide blocks.

  1. Add an Embed block where the tool should appear.
  2. Paste the snippet the service gives you into Embed code.
  3. Set the heading and the options below.
  4. Publish the page, then check the tool on the live page.
The editor settings panel with an Embed block selected.
The Embed block
OptionWhat it does
Eyebrow, Title, SubtitleThe short heading above the tool
Embed codeThe snippet, up to 16 KB. "Runs as typed on the published site only, outside the consent banner."
LoadWhen visible loads the tool as the visitor scrolls near it. Immediately loads it with the page
WidthContent or Wide
Height50%, 75% or 100% of the screen height. The tool scrolls inside this box, so the page never jumps while it loads
Vertical paddingTop and bottom, Top only, Bottom only or None
AnchorA name for the block's address, so links can open the page at this block
BackgroundThe block's background

In the editor the block shows "Embedded content shows here on the published site." in place of the tool. A snippet over the limit shows "Keep the embed code to 16 KB."

Your own AI assistant

An assistant connected with an AI access token can change custom code and Embed blocks only if you turned on Allow custom code and embeds on its token. When it has changed custom code, the publish dialog shows "Custom code changed by your AI assistant on" a date under Site settings, so you can review it before you publish. See Connect your own AI assistant.

If the site moves to Free

Your code is kept, but it stops running: custom code is left off the live site and Embed blocks are left out of its pages. Both come back when the site returns to Studio. See Plans and billing.