window. Listen to them to track behaviour in your analytics, react to answers, or run your own code at the right moment.
event.detail. Two things are always there:
quizId: which quiz fired the eventllQuizApi: the Quiz API, so you can read or change the quiz right in the listener
ll-quiz-init fires as soon as the quiz is ready, which can be before your script runs. Do not worry about it: a listener registered late still receives ll-quiz-init. All other events fire on visitor actions, after your script is in place.Events at a glance
ll-quiz-init
Fires once the quiz is on the page and ready. This is where you grabllQuizApi, prefill values, or set things up.
ll-quiz-step-view
Fires every time a step is shown, including the first one on load and when the visitor goes back.Answers given so far, see fields and fieldsSimple
ll-quiz-step-leave
Fires when the visitor navigates away from a step, before the nextll-quiz-step-view. Use it to measure how long a step took or to save a draft.
ll-quiz-value-change
Fires when an answer is committed. Typed fields (text, email, phone, number, textarea, date, birth date, zip code, address, OTP) commit when the visitor leaves the field or the step, so you get one event per answer, not one per keystroke. Every other input, and every value set through the API, commits immediately.user: the visitor. api: your script through the Quiz API. system: the quiz itself, for example clearing answers after submitfields on ll-quiz-step-view.
ll-quiz-input-click
Fires when the visitor clicks an option of a multiple choice or image choice block. Fires beforell-quiz-value-change for the same click.
ll-quiz-button-click
Fires when a Continue, Previous, Submit or Button block is clicked, before any validation. It fires even when the click ends up blocked, so it counts attempts, not successes.ll-quiz-validation-error
Fires when an attempt to leave a step was blocked because something on it is invalid. You get one event per attempt, after all checks finished (including the server checks of email, phone and OTP fields), listing exactly the errors the visitor sees. Hidden blocks are never included.user: a button or a navigating option. api: your script (validateStep(), goNext(), goToStep(), submit()). system: the quiz tried to advance on its own (loader, countdown, payment)One entry per failing block, in step order:
blockId, blockName, blockType, and messages (the texts shown; the first one is displayed)ll-quiz-google-address-select
Fires when the visitor picks a suggestion in a Google Address block.ll-quiz-submit
Fires when the quiz was submitted, after the lead was saved. This is the place to send answers elsewhere or fire a conversion.What the LanderLab server answered, or
null when no lead was saved (for example lead saving is off in the quiz settings)ll-quiz-exit
Fires when the tab or window is closed or navigated away from, based on the browser’spagehide event.
fields and fieldsSimple
fields is a list with one entry per answered block:
fieldsSimple is the same information as one object keyed by label, handy for forwarding:
fieldsSimple joins their values with a comma. The Quiz API returns the same shapes from getAnswers() and getAnswersSimple().