> ## Documentation Index
> Fetch the complete documentation index at: https://docs.beyondwords.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Magic Embed

Magic Embed lets you add BeyondWords to any web platform without a backend integration. Add a script to your article template and BeyondWords will automatically ingest content from live pages, generate [audio](https://docs.beyondwords.io/docs-and-guides/audio.md), [video](https://docs.beyondwords.io/docs-and-guides/audio/video.md), or both, and install the widget.

Magic Embed is also known as the **client-side integration**. If you're using the [JavaScript SDK](https://docs.beyondwords.io/docs-and-guides/widget/installation/javascript-sdk.md) directly, the equivalent setting is [`clientSideEnabled`](https://docs.beyondwords.io/docs-and-guides/widget/developer-guides/properties#param-client-side-enabled).

> [!TIP]
>
> Using WordPress with Elementor or another page builder? The [WordPress plugin](https://docs.beyondwords.io/docs-and-guides/integrations/publishing-platforms/wordpress.md) can use Magic Embed as an alternative to its default REST API integration. You can also set up other distributions for your audio and video content.

> [accordion] Use the API
>
> Set up Magic Embed with the [BeyondWords API](https://docs.beyondwords.io/api-reference/overview.md):
>
> * [Get Magic Embed settings](https://docs.beyondwords.io/api-reference/magic-embed/show.md): `GET /projects/{project_id}/integrations/client_side`
> * [Turn on Magic Embed and set allowed domains](https://docs.beyondwords.io/api-reference/magic-embed/update.md): `PUT /projects/{project_id}/integrations/client_side`
> * [Skip content published before a date](https://docs.beyondwords.io/api-reference/projects/update.md): `PUT /projects/{id}`

## How it works

Magic Embed is a **client-side** integration. The script runs in the visitor's browser each time an article page loads, but content ingestion works differently on the first visit versus later ones.

* **First visit**: When an article hasn't been ingested before, the script triggers [content extraction](https://docs.beyondwords.io/docs-and-guides/import-content/content-extraction.md) from the live page and starts audio/video generation. The widget appears once generation is complete.
* **Later visits**: The widget loads existing audio/video straight away. BeyondWords periodically re-checks the live page for updates, but not on every visit. If you've edited the article on your website, changes are picked up automatically over time.

If you don't pass an identifier, the page URL (`window.location.href`) is used by default. This works out of the box, but we **recommend passing a `sourceId`** (your CMS article ID) in the embed code wherever you can. Magic Embed will use it as the content's `source_id`, which lets you search for content by source ID in the project dashboard, embed the widget on other surfaces using the same ID, and take advantage of platform features such as [webhooks](https://docs.beyondwords.io/docs-and-guides/import-content/sources/webhooks.md) and [syndicated content](https://docs.beyondwords.io/api-reference/content/syndicated.md) that key off `source_id`.

> [!TIP]
>
> URLs can change if an article moves. A `sourceId` tied to your CMS article ID is more stable and consistent across your site, apps, and integrations.

> [!NOTE]
>
> On the first visit, the widget won't appear until audio/video generation is complete. If a domain isn't in your allowed domains list, content won't be ingested and the widget won't load.

> [!WARNING]
>
> Adding the embed to a site-wide article template means **every** article that gets visited, including older back-catalog articles, can be imported the first time someone views it. To avoid this, [limit which articles get audio](#limit-which-articles-get-audio) before you install the embed.

## Install Magic Embed

> [!WARNING]
>
> If you don't want to import your entire archive, go to **Content → Preferences → Imports** and set the **Earliest publish date** before setting up the integration.

**1. Enable Magic Embed**

Go to **Content → Sources → Magic Embed** and switch the toggle on.

**2. Add allowed domains**

In the **Allowed domains** field, enter each domain where Magic Embed should work, then click **Add**.

Include production, staging, preview environments, and any subdomains (e.g., `www.example.com` and `staging.example.com` are separate entries). If a page's domain isn't on this list, BeyondWords won't ingest content from it.

**3. Copy the embed code**

In the **Embed code** dropdown, select what type of content you want to embed: audio article, audio summary, video article, or video summary.

Click the copy icon next to the embed code. You'll need it in step 6.

Then, click **Save changes**.

**4. Set request headers (optional)**

For paywalled or protected content, configure authentication headers so BeyondWords can access your pages. These are project-level [extraction settings](https://docs.beyondwords.io/docs-and-guides/import-content/content-extraction.md#protected-content-access), shared with the RSS Feed Importer and URL imports.

1. Go to **Content → Preferences**.
2. Under **Protected content access**, enter a **Header name** and **Header value**.
3. To add another header, click **+**.
4. Click **Save**.

> [!NOTE]
>
> Requests will be made with `User-Agent: BeyondWords Importer`

**5. Enable IP allowlisting (optional)**

If your website requires IP allowlisting, turn on **IP allowlisting** in your [extraction settings](https://docs.beyondwords.io/docs-and-guides/import-content/content-extraction.md#ip-allowlisting).

1. Go to **Content → Preferences**.
2. Turn on **IP allowlisting**.
3. Click **Save**.
4. Allowlist the displayed **Static IP address** in your firewall, CDN, or server configuration.

> [!NOTE]
>
> Requests will be sent from `20.234.8.180`

**6. Add the embed code to your website**

Paste the script into your article template where you want the widget to appear. The widget is inserted immediately after the script tag.

A typical embed code looks like this. Pass your CMS article ID as `sourceId` if your template has access to it:

```html theme={null}
<script async defer
  src="https://proxy.beyondwords.io/npm/@beyondwords/player@latest/dist/umd.js"
  onload="new BeyondWords.Player({
    target: this,
    projectId: YOUR_PROJECT_ID,
    sourceId: YOUR_ARTICLE_ID,
    clientSideEnabled: true,
  })">
</script>
```

Copy the base snippet from your dashboard, then add `sourceId` in your article template. The snippet includes your project ID and the settings for the format you choose in **Embed code**. If you've set up a sign-in provider on the **Access → Authentication** page, it also includes `authProvider`. Keep it, and add it to any embeds you installed before setting up authentication.

## Limit which articles get audio

Because Magic Embed imports content on the first visit to a page, placing the embed in your global article template means old articles are imported as soon as they get traffic. To limit this, set either of these in your project dashboard:

* **Content → Preferences → Imports → Earliest publish date**: Older articles aren't imported.
* **Audio → Preferences → Audio generation → Only generate audio for items published on or after**: Older articles are imported as text only.

To stop the embed loading on older articles at all, only output it for content published on or after a cutoff date:

> [tab] Template-level (recommended)
>
> Use your CMS or templating engine to only output the embed for recent articles, comparing the article's publish date to a cutoff when the page is rendered. Old articles never load the script, so they're never ingested.
>
> The exact syntax depends on your platform. The example below is pseudo-template code:
>
> ```html theme={null}
> <!-- Only render the BeyondWords embed for articles published on or after the cutoff -->
> {{ if article.published_at >= "2026-06-01" }}
>   <script async defer
>     src="https://proxy.beyondwords.io/npm/@beyondwords/player@latest/dist/umd.js"
>     onload="new BeyondWords.Player({
>       target: this,
>       projectId: YOUR_PROJECT_ID,
>       sourceId: YOUR_ARTICLE_ID,
>       clientSideEnabled: true,
>     })">
>   </script>
> {{ endif }}
> ```

> [tab] Client-side date check
>
> If template-level logic isn't available, gate loading in the browser. Read the article's published-time meta tag and only inject the widget script when the article is newer than your cutoff:
>
> ```html theme={null}
> <meta property="article:published_time" content="2026-06-01T00:00:00Z" />
>
> <script>
>   (function () {
>     var cutoff = new Date('2026-06-01');
>     var meta = document.querySelector('meta[property="article:published_time"]');
>     if (!meta) return;
>     if (new Date(meta.getAttribute('content')) < cutoff) return;
>
>     var current = document.currentScript;
>     var player = document.createElement('script');
>     player.async = true;
>     player.defer = true;
>     player.src = 'https://proxy.beyondwords.io/npm/@beyondwords/player@latest/dist/umd.js';
>     player.onload = function () {
>       new BeyondWords.Player({
>         target: player,
>         projectId: YOUR_PROJECT_ID,
>         sourceId: YOUR_ARTICLE_ID,
>         clientSideEnabled: true,
>       });
>     };
>     current.parentNode.insertBefore(player, current);
>   })();
> </script>
> ```

> [!NOTE]
>
> Replace the cutoff date and `YOUR_PROJECT_ID` / `YOUR_ARTICLE_ID` with your own values. The `article:published_time` meta tag is just an example. Most CMSes already emit it, but you can target whatever publish-date field your template exposes.

## Content filters

Magic Embed uses [automatic extraction](https://docs.beyondwords.io/docs-and-guides/import-content/content-extraction.md#automatic-extraction) by default, which identifies editorial content on your page and ignores most non-article elements. In practice, most publishers also set up **content filters** to fine-tune what gets included or excluded, for example:

* **Exclude** newsletter sign-ups, related-article blocks, social embeds, or author bios that shouldn't be read aloud.
* **Include** only a specific container when automatic extraction picks up more than you need.

Filters are applied alongside automatic extraction, so you don't need to switch extraction modes to use them. Configure them in **Content → Preferences → Filters** in your project dashboard.

See [content filters](https://docs.beyondwords.io/docs-and-guides/import-content/content-extraction.md#filters) for how to create include and exclude rules, and the available [filter types](https://docs.beyondwords.io/docs-and-guides/import-content/content-extraction.md#filter-types) (class, ID, XPath, text, and more).

> [!TIP]
>
> If you need precise control over metadata such as title, author, or publish date, use [data attributes](https://docs.beyondwords.io/docs-and-guides/import-content/sources/data-attributes.md) next to filters.

## Fine-tuning your integration

Beyond filters, you can further refine how Magic Embed processes your pages:

* [Content extraction](https://docs.beyondwords.io/docs-and-guides/import-content/content-extraction.md): Extraction modes and advanced filter configuration.
* [Data attributes](https://docs.beyondwords.io/docs-and-guides/import-content/sources/data-attributes.md): Explicitly define title, author, publish date, and other fields in your HTML.
* [Widget settings](https://docs.beyondwords.io/docs-and-guides/widget.md): Customize widget appearance and behavior.
* [Segment detection](https://docs.beyondwords.io/docs-and-guides/widget/developer-guides/segment-detection.md): Magic Embed automatically retrieves segment markers from your page for text highlighting.

You can also distribute generated content beyond the widget using [playlists](https://docs.beyondwords.io/docs-and-guides/audio/distribution/playlists.md), [podcast feeds](https://docs.beyondwords.io/docs-and-guides/audio/distribution/podcast-feeds.md), and [downloads](https://docs.beyondwords.io/docs-and-guides/audio/distribution/download.md).

## FAQs

> [accordion] What happens if I update my live article?
>
> BeyondWords periodically re-checks your live article for changes and regenerates audio/video when it detects an update. It doesn't re-ingest the page on every visit. This happens automatically unless you've disabled automatic updates in the editor (see below).

> [accordion] What happens if I make changes in the editor?
>
> If you make changes to content generated via Magic Embed in the editor, the content will be regenerated accordingly. However, any future changes to your live article may trigger regeneration, which will overwrite changes you made in the editor.
>
> To preserve your edits, go to the **Info** tab in the editor and turn off **API updates**. This stops automatic sync from your website, so future changes on your live article will no longer be picked up.
>
> If you want article updates to continue syncing automatically, use [content filters](https://docs.beyondwords.io/docs-and-guides/import-content/content-extraction.md#filters) to control what gets included or excluded from audio generation instead of editing articles manually in the editor.

> [accordion] Will the widget appear before audio/video is generated?
>
> No. The widget only appears once content has been generated and is ready to play.

> [accordion] How does Magic Embed extract content?
>
> Magic Embed uses [automatic extraction](https://docs.beyondwords.io/docs-and-guides/import-content/content-extraction.md#automatic-extraction) by default. If the extracted content is incorrect, use [content filters](https://docs.beyondwords.io/docs-and-guides/import-content/content-extraction.md#filters) or [data attributes](https://docs.beyondwords.io/docs-and-guides/import-content/sources/data-attributes.md) to control what BeyondWords includes or excludes.

> [accordion] How do I stop old articles from generating audio?
>
> This usually happens when the embed is added to a site-wide article template, so any visit to an older article triggers generation on the first view. To only generate audio for recent content, set an **Earliest publish date** or an **Only generate audio for items published on or after** date. See [limit which articles get audio](#limit-which-articles-get-audio).

> [accordion] Do I need to import all my content?
>
> No, you don't need to import all your content. You can choose how far back to import content.
>
> 1. Go to **Content → Preferences**.
> 2. Under **Imports**, select an **Earliest publish date**.
> 3. Click **Save**. For any future imports, BeyondWords will skip content published before the selected date or with no publish date.

## Get help

If you encounter issues or have questions, [contact support](https://docs.beyondwords.io/docs-and-guides/support.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.