Print this page

Embed "Poll Everywhere" Voting and Results in Your Website

I just read about Poll Everywhere on Teach42. If you're not familiar with the Poll Everywhere service, it's a website that allows you to create online polls.

Simple enough, but the cool part is that people can respond via cell phones. As Steve suggests on his blog, this would be a pretty nifty educational tool, if the prohibitive costs can be worked out.

What caught my attention was that Poll Everywhere advertises that you can embed the poll results into a Power Point presentation, but it's not apparent that you can embed them in a website. Well, you can. And it's pretty simple.

The Poll results are stored in a .swf (flash) file. This seems to be generated on Poll Everywhere's server when you create the poll, and I'm assuming it has a static URL. If you plug the URL of the flash file into your webpage, you can get the results to show up.

Results of a poll about coffee consumption. You won't see it without Flash enabled.

Here's the valid HTML code to do so:

<object width="600" height="500" type="application/x-shockwave-flash" data="http://polleverywhere.com/polls/LTg0MDQ2MTA4Mw.swf">
<param value="http://polleverywhere.com/polls/LTg0MDQ2MTA4Mw.swf" name="movie" />
<p>Results of a poll about coffee consumption. You won't see it without Flash enabled.</p>
</object>

The standard width of the movie seems to be about 725. I shrunk it so that it would fit into my template. You can see it full size in a new window here. You can adjust the "width" attribute to be what you want, and it should bring up a scroll bar for the flash object.

In order to display your own poll result, replace the URL in "data=" and in "<param value=" with the URL for your own poll.

To find the URL of your own poll, bring it up on Poll Everywhere's website and view the HTML source of the page. About halfway down the page, you should see this bit of code.

<script type='text/javascript'>
var so = new SWFObject('http://polleverywhere.com/polls/LTg0MDQ2MTA4Mw.swf', 'polleverywhere', '100%', '550px', '9', '#FFFFFF');
so.useExpressInstall('/expressinstall.swf');
so.write('result-flash');
</script>

The URL in there (starting with "http://polleverywhere.com/polls/") is the URL of your flash file. As far as I can tell, this is always identical to the URL that you use to access the actual poll, but with ".swf" at the end.

For one final added touch, you can add your web-based voting to your own website as well.

The voting mechanism is pretty simple. The site uses javascript to create a form. The form doesn't actually have any elements but a submit button. All we have to do is re-create one form for each voting option - the action (the URL the form is sent to) determines how the vote is cast.

For each button, you'll use this snippet of HTML.

<form method="post" action="http://polleverywhere.com/polls/LTg0MDQ2MTA4Mw/results?option_id=1280">
<input type="submit" value="Plenty (3 Cups)">
</form>

All you have to change is the URL in the "action" attribute. To get that URL, go to the web-based voting option on Poll Everywhere's website. If you hover your mouse over one of the options, you should see a URL in the status bar of your browser. If you right-click and choose "Copy Link Location," you'll add the URL to your clipboard.

Now create an identical form for each option and copy and paste the different URL's into the action. Finally, change the 'value="Plenty (3 Cups)"' attribute to the text you want to appear on the button.

And that's all there is to it. You've now embedded the flash object into your website, and you've re-created the voting buttons.

Add A Comment

Add a Comment
Brad Gessler left this on March 6, 2008, 3:11 am

You'll be very delighted to find out that we just released Gizmos for Poll Everywhere! Now if you want to embed a poll in your website, you just click "Embed in website or blog" in the Poll Everywhere editor, then copy and paste the 1 line of javascript where you want your poll to appear.

We've got some more details about Gizmos posted up at http://blog.polleverywhere.com/2008/03/06/subscriptions-and-new-features/ and of course you can sign up, get 1,000 free votes per month, and try it out yourself at http://www.polleverywhere.com/

Enjoy!

Sean left this on January 3, 2008, 12:00 pm

Hi, I'm one of the founders of Condense, the company that develops the Poll Everywhere product. I'm glad you're making some use of it and we hear your need for web voting. This is something we are currently working on. Please do check back as we are continuously improving the product based on this same kind of incredible, detailed feedback. We are listening and responding to what our customers really want from the product.