Share quiz score on Facebook and twitter?

hello !

my client need to post a quiz final score (made with hype of course) on facebook and twitter posts (using sharers).

for the score i use this excellent read : Howto: Simple Quiz Example

the score system is working fine… but how to share the user final score on Facebook and Twitter ?

is it possible to achieve that ?

thank you all


if you have the fb api included in HeadHTML you can send a post via this script:

  window.fbAsyncInit = function() {
      appId      : 'xxx', //Your App ID
      xfbml      : true,
      version    : 'v2.5'

  (function(d, s, id){
     var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) {return;}
     js = d.createElement(s); = id;
     js.src = "//";
     fjs.parentNode.insertBefore(js, fjs);
   }(document, 'script', 'facebook-jssdk'));

trigger this script on button click

  method: 'feed',
  link: 'http://www.sampleURL',
  description:'You answered ' + window.quizScore + ' out of 10 questions correctly',
  picture: '',
  name: 'Name',
}, function(response){});

Best Regards


thank you very much olof !

by the way now i need a Facebook app iD. no problem if my quiz is made with hype ? do i need to import my quiz in the Facebook app ?

merci beaucoup !

1 Like

You only need the ID and the URL from where you will post.

You setup all of these in fb developer section.

1 Like

thank you very much Olof !

1 Like

sorry olof, but how to trigger the script on button click ?

i’ve already got a Facebook share button via iFrame to share the quiz via share_button.php

could you help me with that ?

thank you again…

f e w

here is a working example i did last year.
it’s in german and english and a little more complex then the original one

  • shuffled questions
  • english and german texts via initial.js
  • to change the language put ?lang=en or ?lang=de at the end of the .html file
  • first scene only showed on mobile devices (219.1 KB)


thanks a lot Olof for your example file !! my quiz for mobile is now working perfectly !

for the quiz I created a second screen resolution in hype (for iPad) and I had to deal with the unique ID… so I duplicate everything (functions)… the ‘score’ is now ‘score2’ and it’s working fine… the problem is with the Facebook share : do I need to change something to make the FB share function to work ? because the share page don’t appear :frowning: !

thank you to give me a hint… the deadline is… TODAY !


thanks again

f e w

Share me a link so I can see what you have

in french

1 Like

Dear Olof and few

This article I think is an answer to my prayers. I have been searching for exactly what Olof was requesting: an option to share the actual quiz score on i.e. facebook.

Not being a technical person, I will need help to create a quiz-template, with this feature included.
Can you by any chance direct me to quiz templates using this feature, or at least with an option to add this code to the template?

I should add that the quiz is for a WP site, I am preparing to move my (MUST/html) site to.

Hoping for advise - all the best.