PrinPoll developer docs

Developers

Embed widget

Add PrinPoll voting or ticketing to your website with a script tag.

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

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

AttributeValues / purpose
data-prinpoll-eventRequired event ID.
data-viewvote, nominee, results, or tickets.
data-nomineeOptional nominee ID for a nominee-focused view.
data-key on scriptRequired 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

EventData / 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

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.