A Lantern quiz runs in its own frame on your store page (and on its own page at the public quiz URL). The tags you've installed on your theme, including the ones from the Google and Facebook sales channels, don't see what happens inside it. This article covers the four ways to get quiz events into your own tools:
Google Tag Manager (and through it Google Ads, GA4 and most tag-based tools)
Quiz events on your page for your own scripts, Microsoft Clarity, Northbeam, Hyros, Hotjar and similar
Shopify customer events for custom pixels in your Shopify admin
Meta Pixel, which has its own built-in integration
Google Tag Manager
The Google tag field under Advanced Analytics accepts a Tag Manager container ID (GTM-XXXXXXX) as well as a GA4 measurement ID (G-) or a Google Ads tag (AW-). You can enter it per quiz, in the quiz editor under Settings, or once for the whole store with the Store default field, which applies to every quiz that doesn't have its own ID.
Once a container ID is set, Lantern loads your container inside the quiz and sends every quiz step as a Custom Event: load_welcome_screen, leave_welcome_screen, load_question_page, submit_answer, load_email_page, submit_email, load_results_page, display_results, add_to_cart, go_to_product_page and the rest. The full list with their parameters is in Google Analytics Custom Events & Dimensions.
One thing to know about parameters. Because Lantern delivers the events through the Google tag, Tag Manager stores their parameters under eventModel, not at the top level of the data layer. So a Data Layer Variable for the quiz ID is named eventModel.quiz_id, the session is eventModel.lantern_session_id, the question title is eventModel.title, and so on. If you create a variable called quiz_id it will come back empty. Alternatively use the Event Data variable type, which reads the same values.
Fire a tag when the quiz is completed
In your container, create a Trigger of type Custom Event with the event name
display_results. Usesubmit_emailinstead if you want the moment the shopper enters their email, orleave_welcome_screenfor the moment they start.Create the Tag you need (a Google Ads conversion, a GA4 event, a Custom HTML tag for any other tool) and attach that trigger.
For a Google Ads conversion, use the Google Ads Conversion Tracking tag type with your conversion ID and label. Lantern's own Google tag field can load an AW- tag, but a conversion needs a conversion label, which is exactly what the Tag Manager tag gives you.
Submit and publish the container.
Check that it works
Open Preview in Tag Manager and enter the quiz's public URL (copy it from the quiz's Publish page in Lantern). Walk through the quiz. In Tag Assistant you should see one entry per step with the event names above, and your tag listed under "Tags Fired" on the step you chose. To look at a parameter, open the step, pick the Variables tab and look for eventModel.
Cookie consent
Lantern reads the shopper's consent through Shopify's Customer Privacy API and passes it to your container as Google Consent Mode signals: analytics consent sets analytics_storage, marketing consent sets ad_storage, ad_user_data and ad_personalization. A GTM- or AW- tag loads as soon as the shopper allows either analytics or marketing cookies; a plain GA4 G- tag loads only with analytics consent. Tags inside your container then follow the consent settings you've given them in Tag Manager. If your store doesn't require consent for a region, everything is treated as granted. More in How Lantern Handles Cookie Consent.
Privacy note. The Google events never contain the shopper's email, phone number or name, and answers to questions marked Don't share or Don't store are left out. Google's terms don't allow personal data in Google Analytics, so please don't add it yourself in a tag.
Quiz events for your own scripts
The quiz announces each step as a browser event you can listen to with a few lines of JavaScript, no tag manager required. This is the route for tools that need a page view per quiz step (Microsoft Clarity, Northbeam, Hyros, Hotjar, Mixpanel) and for anything custom.
Where to put the script. If the quiz is embedded on a page or opens as a popup, add the script to your theme (for example theme.liquid): Lantern forwards every event to the page that contains the quiz. If shoppers open the quiz at its public URL, paste the script into the quiz's Tracking Code box under Settings in the quiz editor instead. The event names and data are identical in both places, so the same snippet works for both.
The events, each with its data in event.detail:
lantern:navigate: fired on every screen change.path(/,/questions/3,/results),step_type(welcome,question,transition,email,results),question_id,question_title,quiz_id,session_id. This is the one to use for page-view style tracking.lantern:display_question: a question is shown.id,title,description,type,options,isRequired.lantern:submit_answer: a question is answered. The same fields plusproperty_idandanswers(the chosen labels). On the email step it carriesemail,phone,first_nameandmarketing_consentinstead, since this is your own page.lantern:reach_results_page: the results page opened, before recommendations are computed. No data.lantern:display_results: recommendations are on screen.results(the recommended products with their scores),content_block_results,answers,email,first_name,marketing_consent.
Answers to questions marked Don't share or Don't store never appear in answers.
A minimal listener
<script>
window.addEventListener("lantern:navigate", function (event) {
console.log("Quiz step", event.detail.path, event.detail.step_type);
});
window.addEventListener("lantern:display_results", function (event) {
console.log("Recommended products", event.detail.results);
});
</script>
Microsoft Clarity
Clarity records the page, not the frame, and the page URL doesn't change while the shopper moves through the quiz. Tag the session with the quiz step so you can filter recordings by it:
<script>
window.addEventListener("lantern:navigate", function (event) {
if (window.clarity) {
window.clarity("set", "lantern_step", event.detail.step_type);
window.clarity("set", "lantern_path", event.detail.path);
if (event.detail.step_type === "results") window.clarity("event", "lantern_quiz_completed");
}
});
</script>
Northbeam, Hyros and other attribution tools
These tools want a page view whenever the shopper reaches a new screen. Call their page-view function from the navigate event; the example uses Northbeam's, replace it with the equivalent call from your tool's documentation:
<script>
window.addEventListener("lantern:navigate", function (event) {
if (window.Northbeam && typeof window.Northbeam.trackPageView === "function") {
window.Northbeam.trackPageView();
}
});
</script>
Hotjar
<script>
window.addEventListener("lantern:navigate", function (event) {
if (window.hj) window.hj("stateChange", "/quiz" + event.detail.path);
});
</script>
Shopify customer events (custom pixels)
Lantern also publishes the key moments as Shopify customer events, so a custom pixel in Settings > Customer events in your Shopify admin can subscribe to them. Shopify applies the shopper's consent to the pixel itself. The events and their data:
lantern_quiz_started:quiz_id,quiz_name,lantern_session_idlantern_lead_captured: the same fields, when an email is submittedlantern_quiz_completed: the same fields plusproduct_ids(the recommended Shopify product IDs)lantern_add_to_cart: the same fields pluscontent_ids(variant IDs),content_name,value,currency
analytics.subscribe("lantern_quiz_completed", (event) => {
console.log("Quiz completed", event.customData.quiz_name, event.customData.product_ids);
});
Meta Pixel
You don't need any of the above for Meta. Enter your Pixel ID under Advanced Analytics and Lantern sends Lead, AddToCart, ViewContent and the custom events LanternQuizStart and LanternQuizComplete itself. See Meta Pixel integration.
If your tool isn't covered here, the quiz events section above is the general answer: every tool with a JavaScript API can be called from a lantern:navigate or lantern:display_results listener. And if you get stuck, contact support with the name of the tool and what you'd like to track.
