参加者を招待する

Allow one vote per member on your website

Embed a poll in your members’ area and give each signed-in member their own code, so nobody can vote twice.

最終更新

If your website has a members’ area, your visitors are already signed in. You know who each one is, so you can let every member vote exactly once without asking for a code or an email address.

It works by combining three things: unique codes, an embedded poll and the code parameter from prefilling. Your site gives each member one code and puts it into the embed. The member sees the questions right away, and the code is used up when they vote.

This is stricter than limiting votes by browser or IP address. A member who switches devices, clears cookies or uses a VPN still has the same code, and that code only works once.

1. Set up the poll

  1. In the poll’s Settings tab, set Duplicate check to Unique code.
  2. Open the Share tab, choose Unique codes and generate one code per member, plus a few spare for people who join later. Make them long, like 10 characters or more. The member never types it, so length costs nothing.

2. Give each member a code

Store the codes on your side and link each one to a member account, for example in a voting_code column of your members table. Assign a code the first time a member opens the page, and always show them the same one after that.

To fetch the codes automatically, use the API: GET/forms/{slug}/codes lists them, and POST/forms/{slug}/codes generates more when you run low. Each code in the list shows whether it has been used.

3. Add the code to the embed

Open the Share tab, choose Embed and copy the embed code. In your members’ area template, add &code= and the member’s code to the end of the src link in the <iframe>:

html
<iframe src="https://strawpoll.com/r/abc123?embed=1&code={{ member.voting_code }}" …></iframe>
<script src="https://strawpoll.com/embed.js" async></script>

Replace {{ member.voting_code }} with however your site prints a value, like <?= $member->voting_code ?> in PHP. This works for Standard, Popup and Full page embeds alike.

Members now go straight to the questions. Once they’ve voted, the code is used. If they open the page again, the poll asks for a code and says the code isn’t valid or was already used, so a second vote isn’t possible.

Keep it safe

  • Only add the code on the server, after sign-in. Never put codes in public pages or in JavaScript that every visitor downloads.
  • One member, one code. Don’t give a member a new code when they reload the page. Otherwise they could vote again.
  • Votes stay anonymous to StrawPoll. We only see the code, not who it belongs to. If you keep the link between codes and members, you can tell who voted for what. For a secret ballot, keep only whether a member has a code, or delete the list once the vote is over.
  • The poll link alone isn’t enough. Someone who finds the link outside your members’ area can open the poll, but can’t vote without a code.

Track turnout

The Unique codes tab shows which codes are Used. Together with your own list of who got which code, you can see which members haven’t voted yet and remind them.

関連記事