Add the widget
Create an empty element with data-prinpoll-event and add the PrinPoll loader script with your publishable key. The loader inserts a PrinPoll iframe; the iframe calls widget API routes. Do not put a secret key in the page.
One-line embed snippet
<div data-prinpoll-event="EVENT_ID" data-view="vote"></div><script async src="https://prinpoll.com/embed/v1.js" data-key="pk_live_xxx"></script>Options
| Attribute | Values / purpose |
|---|---|
| data-prinpoll-event | Required event ID. |
| data-view | vote, nominee, results, or tickets. |
| data-nominee | Optional nominee ID for a nominee-focused view. |
| data-key on script | Required publishable key (pk_live_xxx or pk_test_xxx). |
The iframe uses the configured theme: light, dark, or auto, plus an optional #RRGGBB brand_color. A null brand_color means use PrinPoll's default color. The code generated in the organizer dashboard includes the fixed loader and iframe URL paths.
Allowed domains and theme
Configure https domains in the Developers dashboard. Up to 20 domains are allowed. The iframe receives an enforced Content-Security-Policy frame-ancestors value from the frame-policy route; do not add X-Frame-Options to the widget page.
Widget data routes use the publishable key as the key query parameter. They also require embed_origin, the exact https origin of the embedding page, except frame-policy.
postMessage events
| Event | Data / behavior |
|---|---|
| prinpoll:resize | { type, height } for iframe height adjustment. |
| prinpoll:payment | { type, status, reference, event_id } when a payment reaches a final status; optional in the contract. |
Complete example
Responsive embed example
<!doctype html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Vote with PrinPoll</title>
</head>
<body>
<main>
<h1>Campus Awards</h1>
<div
data-prinpoll-event="EVENT_ID"
data-view="vote"
></div>
</main>
<script
async
src="https://prinpoll.com/embed/v1.js"
data-key="pk_live_xxx"
></script>
</body>
</html>Use data-view="nominee" and data-nominee="NOMINEE_ID" to focus the embed on a nominee. Other supported views are results and tickets.