This widget lets you inlcude the Indie Polls feature requests in any website. Indie Polls.
Add this script tag anywhere in your page (usually before </body>):
<script
src="https://cdn.jsdelivr.net/gh/releasysaas/indiepolls-embeddable-widget@main/dist/widget.js"
defer
data-public-token="YOUR_PUBLIC_TOKEN"
data-class-name="dark"
></script>
data-public-token: required. The public token of the poll/widget, generated from the Indie Polls backoffice. data-class-name: optional. Set to dark for dark mode, or leave empty for light. The script tag also supports a few optional attributes:
data-external-id: a stable identifier for the end user in your system. Used to prevent multiple submissions. data-email: pre-fill contributor email. data-name: pre-fill contributor name. data-embed-target: a CSS selector; if provided, the widget will be rendered inside the matching element instead of attaching to document.body. data-height: desired height for the widget container when using data-embed-target (e.g. 800px, 70vh, 100%). Example with more options:
<script
src="https://cdn.jsdelivr.net/gh/releasysaas/indiepolls-embeddable-widget@main/dist/widget.js"
defer
data-public-token="YOUR_PUBLIC_TOKEN"
data-external-id="user-123"
data-email="user@example.com"
data-name="Jane Doe"
data-class-name="dark"
data-embed-target="#indie-polls-widget-container"
data-height="800px"
></script>
Then in your HTML:
<div id="indie-polls-widget-container"></div>
test/index.html)You can also inject the widget dynamically and assign a random external id at runtime:
<script>
const dynamicUser = Math.random().toString(36).slice(2);
const s = document.createElement('script');
s.async = true;
s.src = 'https://cdn.jsdelivr.net/gh/releasysaas/indiepolls-embeddable-widget@main/dist/widget.js';
s.dataset.publicToken = 'YOUR_PUBLIC_TOKEN';
s.dataset.externalId = `user-${dynamicUser}`;
s.dataset.className = 'dark';
document.body.appendChild(s);
// Optionally, set s.dataset.embedTarget, s.dataset.height, etc.
</script>
This project is licensed under the MIT License. See the LICENSE file for more information.
Releasy CORP, We Build SaaS and Productivity Tools!