pollalot

front

Usage no npm install needed!

<script type="module">
  import pollalot from 'https://cdn.skypack.dev/pollalot';
</script>

README

Pollalot JS Client

Installation

We only support NPM package registry for now.

npm install pollalot

Usage

First you need to instantiate a client:

import Client from 'pollalot';

const client = new Client();
// Here you pass a token, you can retrieve it at your profile page
client.init('c44ab4114e3b9830035fb84d2f78ea51283c2787');

Then, when new user logs into your app, you need to set the current respondent by its email:

client.setRespondent('mike@gmail.com').then(canAsk => {
  // `canAsk` argument is a boolean which says whether the user agreed
  // to answer the questions.
  if (canAsk) {
    // Here you pass an ID of the questionnaire. You can get it on the
    // questionnaire list page.
    client.show('5d1d463d-c16b-4a8f-88fd-dcb237255a25');
  }
});