JS events you can work with

How to catch JS events in general

The following example is written in Javascript and catches the ‘view-quiz-result’ event. Feel free to alter this snippet to any event from below.

function onMessage(event) {
    if (event.data && event.data.riddleEvent) {
        var riddleData = event.data.riddleEvent;
        if ('object' === typeof (riddleData)) {
            if (riddleData.action === 'view-quiz-result') {
                // Your code here
            }
        }
    }
}
window.addEventListener("message", onMessage, true);

 

Lead form events

  • form-submit
  • form-skip

IMPORTANT: when listening to form-submit and form-skip events, there is no action associated to them.

Thus the even listener will have to be riddleData === ‘form-submit’ instead of riddleData.action === ‘form-submit’

Please check your code if you are not getting form-submit events. Most likely you added .action to riddleData

Listen to these events to determine, if someone has reached your result page. The finish-quiz and view-result events are shown when the last question is answered. If you added a lead form, the finish events will show when the lead form is loaded and NOT when the result page is shown after the form is submitted or skipped.

General events

  • page-change: this event is basically the same as ‘turn to the next question’ but it is the same for every quiz type

 

JS Events every quiz type has in common

 Start QuizAnswerFinish QuizSee ResultsTurn to next QuestionIndividual events
Quizstart-quizanswer-quizfinish-quizview-quiz-resultview-each-questionanswer-correct-quiz
Personalitystart-personalityanswer-personalityfinish-personalityresult-personalityview-quiz-of-personality/
Opinion Pollstart-pollanswer-pollfinish-poll///
Surveystart-survey/finish-survey/view-question-of-survey/
Liststart-list/finish-list/view-each-item-in-list/
Interactive Storystart-narrativeanswer-narrativefinish-narrativeresult-narrative / unique-result-narrativeview-page-of-narrativeunique-result-narrative
Reaction Pollstart-sentiment/////
Ranked Liststart-rankedlistanswer-rankedlistfinish-rankedlist///
Tap & Findstart-spot//view-spot-resultview-each-spot/
Order Itstart-lineup/finish-lineupview-lineup-resultview-each-lineup/

 

Got any problems? Feel free to contact us on Intercom or send an email to hello@riddle.com

More on our events can be found here.