Script
Recommended for the web. One tag renders the wall inside your page, sizes it to its content and keeps it up to date.
Inline wall
<div id="surveys"></div>
<script src="https://yetipoll.com/sdk/v1/yetipoll.js"
data-app="yp_test_pk_your_key"
data-user="USER_ID"
data-target="#surveys"
async></script>
Without data-target the wall is placed right after the script tag.
Button that opens the wall
<script src="https://yetipoll.com/sdk/v1/yetipoll.js"
data-app="yp_test_pk_your_key"
data-user="USER_ID"
data-display="button"
data-label="Earn coins"
async></script>
The button has the class yetipoll-button and no styling of its own, so it takes on your site's look.
Options
| Attribute | Meaning |
|---|---|
data-app | Your public key. Required. |
data-user | Your id for the signed-in user. Required. |
data-lang | Two-letter language of the wall. Optional: without it the wall follows the user's browser. See language. |
data-signature | Signature of the user id, when the app requires signed links. See signing. |
data-target | CSS selector of the element to render into. |
data-display | inline (default) or button. |
data-label | Text of the button. |
From JavaScript
For single-page apps, load the script once without data attributes and start it when you know the user:
<script src="https://yetipoll.com/sdk/v1/yetipoll.js" async></script>
<script>
window.addEventListener("load", function () {
YetiPoll.init({
app: "yp_test_pk_your_key",
user: currentUser.id,
target: "#surveys" // or display: "button"
});
YetiPoll.on("survey_opened", function () {
// the user started a survey
});
});
</script>
| Call | Does |
|---|---|
YetiPoll.init(options) | Renders the wall or the button. Options are the attributes above without data-. |
YetiPoll.open() / YetiPoll.close() | Opens or closes the wall as an overlay, from your own button. |
YetiPoll.on(event, handler) | Events: ready, survey_opened, close. |
Content Security Policy
If your site sends a CSP, allow https://yetipoll.com in script-src and frame-src.
Colours and wording
The wall's colour, light or dark background, heading and corner style are set per app in the dashboard, under "Look and feel".