For developers

7. Embeds and integrations

From the THINQ Site developer guide, in the guide's own words. The same text ships with every site's core.

7.1 Two places a vendor widget can go

Where When How
On a page, by an admin The widget belongs to one page and an admin may change it Add the Embed / Code block and paste the vendor's snippet as-is
Inside your own component The widget is part of your design (a schedule built into the Tour section) Render an <iframe> in your component, or the snippet through RawHtml

The Embed / Code block renders exactly what is pasted, <script> tags included (it re-creates each script so the browser runs it, in order). Because its content is executed rather than sanitized, it is admin-only: the server refuses it from an editor account. Its settings: an optional eyebrow and title, minHeight to reserve space for widgets that size themselves after loading, and fullWidth to break out of the centred column.

7.2 What the browser will allow

Every page is served with a Content-Security-Policy. For embeds, what matters:

Kind Allowed from Notes
<iframe> Any https:// site Plain iframes need nothing set up
Inline <script> (code inside the tag) Allowed Runs in the page
External <script src="…"> This site, plus an allowlist Google Tag Manager, Google Analytics, Google Ads, Cloudflare Turnstile and Cloudflare Insights are built in. Any other host must be added on the server as MYPRESS_SCRIPT_HOSTS
Network calls a script makes (fetch, beacons) This site, plus the same allowlist A widget whose script loads but whose data calls fail is usually this
Images, video, fonts, stylesheets Any https:// site

MYPRESS_SCRIPT_HOSTS is an environment variable on the host (space- or comma-separated https://host origins), not something in code, so adding a host takes a redeploy by Bo. Send him the host. When a script is blocked, the browser console says Refused to load the script … because it violates the following Content Security Policy directive: "script-src …" and names the host to add.

7.3 Worked example: Dancebug

Dancebug (registration, tour schedule, livestream) provides iframes. Two of them come with a short inline script that sets the iframe's address and passes the page's own URL (parent_url), which Dancebug uses to return the visitor to the right page after registering. Their snippet has this shape:

<iframe id="dance_bug_iframe" sandbox="allow-top-navigation allow-forms allow-popups
  allow-popups-to-escape-sandbox allow-modals allow-same-origin allow-scripts"
  src="" style="width:100%; height:680px;" frameborder="0"></iframe>
<script>
  var parent_url = window.location;
  document.getElementById("dance_bug_iframe").src =
    "https://dancebug.com/rf/?ifid=288&parent_url=" + parent_url;
</script>

Everything in it is allowed by default: the frame is https://dancebug.com and the script is inline. No allowlist change is needed. Three things to get right:

  1. Copy the snippet from Dancebug's original, not from an email. In the copy that arrived by email on 2026-10-07 the quotes around the URL had been stripped (.src = https://dancebug.com/…), which is a JavaScript syntax error, so the iframe stays blank.
  2. Each widget on the same page needs its own iframe id. All three snippets use id="dance_bug_iframe", and getElementById finds only the first. If registration and the schedule are on one page, rename one (dance_bug_iframe_schedule) in both the iframe and its script.
  3. Open the livestream in a new tab rather than embedding it (Dancebug's advice): link to it with target="_blank" rel="noopener".

The registration widget leaves the page once. On a visitor's first load it sends the whole browser tab to Dancebug to set a cookie, then returns to the page address Dancebug has on file for that widget (this is the "cookie redirection" Dancebug mentioned; it is what the allow-top-navigation permission is for). Tested on 2026-10-21 from a local copy of the site: the Embed block ran the snippet and loaded the iframe, and the tab ended up on https://encoreperformingarts.com/register/, the address registered for ifid=288, not on the test page. So:

  • Put the registration widget on the page whose address Dancebug has on file, or ask Dancebug to change it when the new page's address is decided.
  • On staging or a local copy it will bounce you to the live site. To test the embed before launch, ask Dancebug for a test widget pointed at the staging address.

On a page: paste each snippet into its own Embed / Code block. Set minHeight to the iframe's height so the page doesn't jump while it loads.

In your own component: build the iframe in React instead of pasting the script. It needs the page URL, which only exists in the browser, so it is a small client component:

// src/features/encore/DancebugFrame.tsx
"use client";
import { useEffect, useState } from "react";

export function DancebugFrame({ path, height = 680, title }: { path: string; height?: number; title: string }) {
  const [src, setSrc] = useState<string>();
  useEffect(() => {
    // Same as Dancebug's snippet: their URL plus the page's own address.
    setSrc(`https://dancebug.com/rf/${path}&parent_url=${window.location}`);
  }, [path]);
  return (
    <iframe
      title={title}
      src={src}
      sandbox="allow-top-navigation allow-forms allow-popups allow-popups-to-escape-sandbox allow-modals allow-same-origin allow-scripts"
      style={{ width: "100%", height, border: 0 }}
    />
  );
}

// <DancebugFrame path="?ifid=288" title="Register" />
// <DancebugFrame path="events_list.php?ifid=289" title="Tour schedule" />

No id is needed this way, so any number can share a page. If the widget ids (ifid) should be editable, make them fields of your block.

If Dancebug's colours need to match the new design, that is set on Dancebug's side (they offered to update the iframe's colours).

7.4 Other common embeds

Embed Works as-is?
YouTube / Vimeo Yes. Use the Video block, or an iframe
Google Maps Yes. Use the Map block (or Map — Branded)
A booking or registration widget that is only an iframe Yes
HubSpot, Mailchimp or similar forms with an external script Needs the script's host in MYPRESS_SCRIPT_HOSTS. Consider a THINQ Site form instead (Admin → Forms), which needs nothing and keeps submissions on the site
Chat widgets, tracking pixels (site-wide) Paste into Settings → Custom code (head, start of body, or end of body). External scripts still need their host allowed
Google Tag Manager Put the container id in Settings → Google Tag Manager; it is already allowed

7.5 Rendering vendor markup in your own block

If your block takes a snippet from an editor (a field named html or ending in Html gets a code box), render it with RawHtml:

import { RawHtml } from "@/components/RawHtml";
<RawHtml html={block.embedHtml} className="my-8" />

RawHtml runs the scripts in the markup. That makes the block a script-injection point, so the block definition must set adminOnly: true. The server then refuses the block from an editor session. Never point RawHtml at anything a non-admin can write.

For rich text an editor typed (not vendor code), use SafeHtml, which sanitizes and never runs scripts.

7.6 Data from other systems

THINQ Site has no database, and pages render from files on the server. When a page needs data from another system, the pattern depends on how fresh it must be:

Freshness Pattern
Changes when someone edits it It's content: put it in a block (a repeatable group) so editors maintain it
Daily or hourly is fine (event lists, scores, counts) A scheduled job fetches it, and writes it into the site's content; pages render it instantly and the vendor API is called once per refresh, not once per visitor
Live, per visitor (availability, a basket) A client component that calls the vendor from the browser, or an API route on the site that calls it with a server-side key

Anything that needs a secret key, a scheduled job or a new API route touches the server, so plan it with Bo before building: keys live in the host's environment, never in the repo or in client code.

This text is maintained in thinq-site-core at docs/developers/07-embeds-and-integrations.md (commit e72488e) and published here unchanged.