Skip to main content
The HTML snippet works on any site. Paste it once into the template that renders articles, not into individual posts.

The snippet

Copy the snippet from your widget page in the dashboard. It looks like this:
Embed code
It has two parts:
  • The iframe loads the widget for your widget ID. title and keywords tell it what the article is about.
  • The script listens for messages from the widget. It resizes the frame as the trade panel opens and closes, and hides the frame entirely when no relevant market matches. See postMessage events.
Keep the script. Without it, the frame stays at 260 px: the trade panel gets cut off, and articles with no matching market show an empty space.

Fill in the title and keywords

Replace the two placeholders with your CMS variables: In the copied snippet the braces are already URL-encoded, so the placeholders appear as %7BARTICLE_TITLE%7D and %7BARTICLE_KEYWORDS%7D. Replace the whole placeholder, braces included. Both values must be URL-encoded. Most template languages have a filter for it, for example {{ title | urlencode }}. See CMS templates for examples. The rendered src for one article looks like:
Keywords carry about a third of the match score, and each comma-separated keyword becomes its own search. Two to four specific keywords, such as names, places, tickers or events, work better than a long list of general ones. See Market matching.

Placement

  • Put the widget where a related sidebar or “in this story” box would go: after the first few paragraphs, or at the end of the article.
  • The frame is width="100%" and capped at max-width:560px. You can change the inline style to fit your column, for example max-width:100% to fill a wider slot.
  • Keep loading="lazy" so the widget loads only when readers scroll near it.
  • Use one snippet per page. If you place more than one, give each iframe a unique id and point each script at its own frame.

Attributes you must keep

Content Security Policy

If your site sends a Content-Security-Policy header, allow the widget host as a frame source:
If your policy uses script-src without 'unsafe-inline', move the listener script into one of your own script files or add it to your policy with a nonce or hash. The widget itself needs nothing else from your page.

Single-page apps

In React, Vue and other client-rendered apps, render the iframe as a component and attach the message listener in an effect. See the React example.

Next steps

Test your embed

Check matches and collapse behavior before you publish.

Embed URL reference

Every query parameter the widget accepts.