Add audio to any website
Add the Everlit audio player to your website with a simple HTML snippet. Works with any CMS or custom site, with built-in support for popular platforms.
Overview
The everlitAutoAudio.js script enables automatic audio conversion and playback for your web content.
Simply add two HTML elements to your page and the script handles everything else.
How It Works
1. Content Detection
Script automatically extracts article content from your page
2. Audio Check
Checks if audio already exists for this URL
3. Conversion
Creates audio if needed (typically 30-180 seconds)
4. Player Display
Injects the audio player when ready
Basic Implementation
Add these two elements to your article pages:
<!-- 1. The widget container -->
<div
id="everlit-auto-audio-widget"
data-publication-id="YOUR-PUBLICATION-ID"
style="height: 136px; width: 100%;"
hidden
><a href="https://everlit.audio/" rel="nofollow">Listen to this article — audio by Everlit</a></div>
<!-- 2. The script -->
<script
defer
src="https://cdn.everlit.audio/libs/everlitAutoAudio.js"
type="text/javascript"
></script>
Where to Place It
Place the widget container where you want the audio player to appear—typically at the top of the article,
below the headline, or in a sidebar. The script tag can go anywhere (we recommend before </body>).
Required Attributes
| Attribute | Description |
|---|---|
id="everlit-auto-audio-widget" |
Required. The script looks for this exact ID. |
data-publication-id |
Your Everlit publication ID (found in your dashboard). |
CMS Support
The Everlit script works with any CMS or custom website. It automatically detects article content from popular platforms and falls back to standard HTML patterns for others.
Customizable CMS Support
The Everlit Auto Audio JS can be customized to support any CMS or custom website. Here are a few platforms that are automatically detected with optimized content extraction:
Arc / Fusion
Auto-extracts from Fusion.globalContent. Captures headlines, body text, authors, tags, and sections.
Brightspot
Detects via brightspot.contentId meta tag. Extracts from article body classes and LD+JSON schema.
Next.js
Reads from __NEXT_DATA__ script. Full support for Next.js sites.
Other CMS Platforms
For all platforms (Navigator, Drupal, Ghost, custom sites, etc.), the script uses standard and customizable content detection patterns:
- Looks for
class's containing likely article data - Extracts text from
<p>,<div>, and various other tags within the article - Identifies the article by the canonical URL and leverages any Open Graph or other meta tags to enrich the article
Configuration Options
The widget reads the attributes below. The article URL, title, and content are detected automatically from the page (see CMS Support).
| Attribute | Required | Description |
|---|---|---|
data-publication-id |
Yes | Your Everlit publication ID |
data-everlit-access |
No | Per-visitor paywall signal. Only used when the audio paywall is enabled for your publication (see below). |
Paywall Access Signal
If your publication has the audio paywall enabled, set data-everlit-access
to the current visitor's access status (for example, from the subscription check you run
when rendering the page). When the visitor is blocked, the widget shows a blurred player
with a subscribe call-to-action instead of generating or playing audio.
These values are treated as blocked (case-insensitive):
blocked, false, 0, no,
gated, locked. Any other value—or omitting the
attribute—is treated as allowed. The attribute has no effect unless the paywall is
enabled for your publication.
<!-- Blocked visitor: widget shows the blurred paywall placeholder -->
<div
id="everlit-auto-audio-widget"
data-publication-id="YOUR-PUBLICATION-ID"
data-everlit-access="blocked"
style="height: 136px; width: 100%;"
hidden
></div>
Styling
The widget container should have a minimum height of 136px. The player will appear inside this container when audio is ready. You can style the container to match your site design.
<style>
#everlit-auto-audio-widget {
height: 136px;
width: 100%;
margin: 20px 0;
border-radius: 8px;
overflow: hidden;
}
#everlit-audio-embed-container iframe {
width: 100%;
border: none;
}
</style>
JavaScript Events
The widget dispatches custom events on document (they bubble, so
window listeners work too). Listen for these to respond to conversion
and player state:
| Event | When it fires | event.detail |
|---|---|---|
everlit:processing |
Audio conversion has started for this URL | { processing, url } |
everlit:ready |
The audio player has been injected and is ready | { embed, element, articleId, metadata } |
everlit:clickToCreate |
A "click to create" placeholder is shown (audio not yet generated) | { clickToCreate, processing, element } |
everlit:error |
An error occurred during the check, conversion, or setup | { error, reason } |
Example: Listening for Events
<script>
document.addEventListener('everlit:ready', function (e) {
console.log('Audio player is ready', e.detail);
});
document.addEventListener('everlit:processing', function (e) {
console.log('Conversion started for', e.detail.url);
});
document.addEventListener('everlit:error', function (e) {
console.error('Everlit error:', e.detail.reason);
});
</script>
Player Events
Once enabled, the Everlit player posts realtime playback events from its iframe to your
page via window.postMessage. Use them for on-page activation—fire your
own analytics events, enrich them with your visitor's identity or subscription data, or
trigger a prompt when a listener finishes an episode. They work wherever the player is
embedded: the auto audio widget, playlist embeds, or a direct iframe.
Message Format
{
"type": "everlit:event",
"event": "play", // "play" | "pause" | "complete"
"articleId": "artl_...", // the article being played
"eut": "..." // the end-user tag for this listener
}
| Event | When it fires |
|---|---|
play |
Playback starts or resumes |
pause |
The listener pauses playback |
complete |
The listener crosses 95% of the audio—the same completion definition used in your Everlit analytics, so your counts reconcile with your dashboard. Fires at most once per track. |
Events describe content playback only—ad breaks never emit events. In playlist
embeds, articleId always reflects the track currently playing.
Example: Listening for Player Events
<script>
window.addEventListener('message', function (e) {
if (e.data?.type !== 'everlit:event') return;
// Enrich with your own visitor data and forward to your analytics
yourAnalytics.track('audio_' + e.data.event, {
articleId: e.data.articleId,
everlitListenerId: e.data.eut,
userId: yourCurrentUser.id
});
});
</script>
Correlating with Everlit Analytics
The eut (end-user tag) is the same pseudonymous listener identifier that
appears as client_user_tag in your Everlit metric exports and BigQuery
data. Store it alongside your own user ID to join realtime on-page events with the
full listening history in your exports. If you already pass your own identifier into
the player via the eut parameter, events echo that value back.
Troubleshooting
Common Issues
| Issue | Possible Cause | Solution |
|---|---|---|
| Widget not appearing | Missing or incorrect publication ID | Verify data-publication-id matches your dashboard |
| Content not detected | Non-standard page structure | Add class="articleBody" to your content container, or use the API directly |
| "Click to create" shows repeatedly | URL changes between page loads | Add a stable <link rel="canonical"> tag so the widget reports a consistent URL |
| Audio not playing | Browser autoplay restrictions | User must interact with page first; this is expected browser behavior |
| Wrong content extracted | Multiple article-like sections on page | Use the API with explicit extractedText parameter |
Debug Mode
Check the browser console for debug information. The script logs key events during initialization.