Legacy and Migration
Migrating from an older version of the Ekoo widget
Context
Older integrations use patterns that are no longer recommended:
- Configuration via
window.ekooOptions(global object with flat config format). In v4,ekooOptionsis only used for programmatic widget creation and expects the structure{ websiteId, widgets: [{ nodeId, productId, locale }] }. - Old scripts:
widget-3.x.x.js,widget-4.0.0.js(without the-standalonesuffix). - Widget injection via pure JavaScript (no
data-ekooattributes).
🚨
Do not mix v3 and v4
Never load a v3 script and a v4 script on the same page. This will cause conflicts and unpredictable behavior. Only use widget-4.0.0-standalone.js.
Recommended Approach
For any new integration, use:
Official integration
html
1<ekoo-widget2 data-ekoo="YOUR_WEBSITE_ID"3 data-ekoo-product-id="YOUR_PRODUCT_ID"4 data-ekoo-locale="fr"5></ekoo-widget>67<script src="https://app.ekoo.co/widgets/widget-4.0.0-standalone.js"</script>What Changed Between v3 and v4
| Aspect | v3 (legacy) | v4 (standalone) |
|---|---|---|
| Configuration | window.ekooOptions | data-ekoo-* attributes |
| Script | widget-3.x.x.js | widget-4.0.0-standalone.js |
| Website ID | In the options object | data-ekoo="YOUR_WEBSITE_ID" attribute on the container |
| Product ID | In the options object | data-ekoo-product-id attribute on the container |
| Widget type | In the options object | data-ekoo-type attribute ("standalone" only in v4; carousel requires widget-3.1.0.js) |
| Events | Callback in options | data-ekoo-on-event attribute |
| Custom element | Not supported | <ekoo-widget> |
| JavaScript API | Limited | ekooLoad() / ekooUnload() / ekooReload() |
Migration Checklist
- Replace the script:
widget-3.x.x.js→widget-4.0.0-standalone.js. - Add
data-ekoo="YOUR_WEBSITE_ID"to the<div>container. - Remove
window.ekooOptions(old flat config format) and replace withdata-ekoo-*attributes on the HTML container. If you need programmatic widget creation, use the new format:{ websiteId, widgets: [{ nodeId, productId, locale }] }. - Add
data-ekooto the container (required marker attribute). - Test that the widget displays correctly with a published audio.
- Check events: if you were using a callback in
ekooOptions, migrate todata-ekoo-on-event. - Remove the old script — do not keep both versions side by side.
Before / After Example
❌ Before (legacy)
html
1<!-- ❌ Old integration (v3.x) -->2<script>3 window.ekooOptions = {4 websiteId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',5 productId: 'my-product-123',6 locale: 'fr',7 type: 'standalone'8 };9</script>10<script src="https://app.ekoo.co/widgets/widget-3.x.x.js"></script>11<div id="ekoo-widget"></div>✅ After (v4 standalone)
html
1<!-- ✅ New integration (v4.0.0-standalone) -->2<ekoo-widget3 data-ekoo="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"4 data-ekoo-product-id="my-product-123"5 data-ekoo-locale="fr"6></ekoo-widget>78<script src="https://app.ekoo.co/widgets/widget-4.0.0-standalone.js"</script>✅
Best practice
After migration, monitor the browser console for a few days to ensure there are no residual errors related to old code.