Embed Widget Quick Start
Add interactive flipbook publications to any website with a single script tag. Covers basic embedding, data attributes, and troubleshooting common issues.
- Method 1: Script Tag (Simplest)
- Method 2: Div Container
- Data Attributes
- Common Examples
- Blog Post Embed
- Full-Page Embed
- Responsive Embed
- Auto-Flip Presentation
- Multiple Publications on One Page
- Finding Your Publication Slug
- Troubleshooting
- The embed does not appear
- CORS errors in the console
- Content Security Policy (CSP) blocking the script
- The embed appears but pages do not load
- Embed height does not match content
- Next Steps
Embed Widget Quick Start
The ZenFlip embed widget lets you add interactive flipbook publications to any website with minimal code. The widget creates a responsive iframe that loads the ZenFlip viewer with your publication.
Method 1: Script Tag (Simplest)
Add a single script tag wherever you want the flipbook to appear. The widget renders the publication directly after the script element.
That is all you need. The embed widget automatically initializes when the page loads and inserts an iframe containing your publication.
Method 2: Div Container
For more control over placement, use a div element with the zenflip-embed class and include the embed script separately. This is the recommended approach when you have multiple publications on one page.
The script scans the page for all elements with the zenflip-embed class and initializes each one.
Data Attributes
Configure the embed using HTML data attributes:
Attribute | Default | Description |
| Required | Publication slug (from the publication URL) |
|
| Width of the embed (CSS value: |
|
| Height of the embed (number in pixels or CSS value) |
|
| Auto-flip pages at a timed interval |
|
| Page number to open on initial load |
| Auto | Override the base URL for the viewer (advanced) |
Numeric height values are treated as pixels. You can also use CSS units like 80vh or 500px.
Common Examples
Blog Post Embed
A compact embed suitable for within article content:
Full-Page Embed
Fill the entire viewport with the flipbook:
Responsive Embed
Create a responsive embed that adapts to the container width:
The embed widget always sets max-width: 100% on its wrapper, so it naturally fits within any container without horizontal overflow.
Auto-Flip Presentation
Start on a specific page with auto-flipping enabled (useful for kiosk displays or presentations):
Multiple Publications on One Page
Use the div method when embedding more than one publication:
Finding Your Publication Slug
The publication slug is the URL-friendly identifier visible in the publication URL. You can find it in two places:
Dashboard: Open the publication and look at the URL in your browser:
https://app.zenflip.io/publications/your-slug-hereAPI: The
slugfield in the publication object returned byGET /publications
Troubleshooting
The embed does not appear
Verify the
data-pubattribute matches an existing, published publication slug.Check the browser console for errors. A missing slug produces the warning:
[ZenFlip] Missing data-pub attribute. Skipping embed.Confirm the publication status is
published(draft publications are not accessible via the public viewer).
CORS errors in the console
If you see Cross-Origin Resource Sharing (CORS) errors, the issue is usually with your Content Security Policy (CSP) headers. Add the ZenFlip domain to your CSP frame-src directive:
Content Security Policy (CSP) blocking the script
If your site uses strict CSP headers, you need to allow the embed script:
The embed appears but pages do not load
The publication may still be converting. PDF conversion runs asynchronously after upload and can take a few seconds to a few minutes depending on page count.
If the publication uses
privateaccess or is password-protected, the public viewer endpoint will not return page data. Set visibility topublicfor embeds.
Embed height does not match content
The embed widget uses a fixed height based on the data-height attribute. If pages appear cut off, increase the height value. For a more dynamic approach, use CSS viewport units like 80vh to make the height relative to the browser window.
Next Steps
Advanced Embed Options --- Programmatic API, SPA integration, event handling, and custom styling.
Publications API --- Manage publications and control visibility programmatically.