Skip to main content
Your quiz announces what happens as browser events on window. Listen to them to track behaviour in your analytics, react to answers, or run your own code at the right moment.
Every event puts its data in event.detail. Two things are always there:
  • quizId: which quiz fired the event
  • llQuizApi: 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 grab llQuizApi, prefill values, or set things up.
string
LlQuizApi
The Quiz API for this quiz

ll-quiz-step-view

Fires every time a step is shown, including the first one on load and when the visitor goes back.
string
string
Field[]
Answers given so far, see fields and fieldsSimple
object
The same answers as label → value

ll-quiz-step-leave

Fires when the visitor navigates away from a step, before the next ll-quiz-step-view. Use it to measure how long a step took or to save a draft.
string

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.
string
string
The block’s name from the builder
string
For example text-field or multiple-choice
string
string
string
The new answer, in the same format as Field.value
string
The answer reported last time, or the value the quiz loaded with
'user' | 'api' | 'system'
user: the visitor. api: your script through the Quiz API. system: the quiz itself, for example clearing answers after submit
Nothing fires when the value did not change. Values already present when the quiz loads (defaults, URL parameters, restored answers) are the starting point and do not fire; they are in fields 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 before ll-quiz-value-change for the same click.
string
string
string
string
string
string
The option’s value, as stored in the answer
string
The text the visitor saw

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.
string
string
string
string
To know whether the click actually moved the visitor on, pair it with ll-quiz-step-leave (it did) or ll-quiz-validation-error (it did not).

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.
string
string
'user' | 'api' | 'system'
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)
string
The button or option that started it; empty for api
string
Empty for api
array
One entry per failing block, in step order: blockId, blockName, blockType, and messages (the texts shown; the first one is displayed)
It does not fire when the step is valid, when the Previous button is used (it never validates), or for a choice click that does not navigate.

ll-quiz-google-address-select

Fires when the visitor picks a suggestion in a Google Address block.
string
string
string
string
object
street, city, state, stateShort, postalCode, country, countryShort

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.
string
The step the visitor submitted from
string
Field[]
All answers
object
All answers as label → value
any
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’s pagehide event.
Browsers do not guarantee this event on every close. Use it for best-effort tracking with navigator.sendBeacon, never for anything that must happen.

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:
Both leave out hidden blocks and empty answers. If two blocks share a label, fieldsSimple joins their values with a comma. The Quiz API returns the same shapes from getAnswers() and getAnswersSimple().