Skip to main content

Meta Pixel Integration

Written by Traian

Lantern can send your quiz activity straight to your Meta Pixel, so you can optimize Meta ads for quiz completions, build retargeting audiences from quiz takers, and see your quiz funnel in Events Manager. You only need your Pixel ID. There's no code to paste.

Why this exists: your quiz runs in its own frame on your store, so the Meta pixel installed on your theme (for example through the Facebook & Instagram channel) never sees what happens inside the quiz. Pasting the pixel code into the Tracking Code box only gets you a PageView. With the integration, Lantern fires the events itself at the right moments.

Lantern's Meta Pixel tracking respects your customers' marketing cookie consent through Shopify's Customer Privacy API. If marketing cookies are declined, Lantern will not load the pixel or send any events. Learn more in How Lantern Handles Cookie Consent.

Step 1: Find your Pixel ID

1.1 Open Meta Business Settings and go to Data Sources → Datasets & pixels.

1.2 Select the pixel (dataset) you use for your store. The Dataset ID shown under its name is your Pixel ID. It's a number, usually 15 or 16 digits long.

1.3 Click the ID to copy it to your clipboard.

Step 2: Add it in Lantern

You can do this in two places. Both update the live quiz right away, and you don't need to republish.

Option A: for all your quizzes at once

2.1 In Lantern, open Advanced Analytics.

2.2 In the Meta Pixel card, click Setup Meta Pixel.

Image showing where to open the Meta Pixel setup from Advanced Analytics in Lantern.

2.3 Enter your Pixel ID in Store default to track every quiz with one pixel. Only fill the per-quiz Pixel ID for a quiz that should use a different pixel. Then choose when the Lead event fires and click Save & Finish Setup.

Image showing the Meta Pixel setup in Lantern with a Pixel ID, Lead event option, PageView setting, and Save & Finish Setup button.

Option B: for one quiz, from the editor

2.4 Click Edit Quiz and open the Settings tab.

2.5 In the Pixels & Analytics card, paste your Pixel ID and click Save.

Image showing Lantern’s Pixels & analytics settings for individual quiz, with the Meta Pixel ID field, automatic Lead event setting, enabled PageView checkbox, and Save button highlighted.

Already pasted the pixel base code into the Tracking Code box? Remove it once you've entered the Pixel ID, otherwise the pixel loads twice and you'll see duplicate PageViews.

Step 3: Choose how Lead and PageView behave

Send the Meta Lead event:

  • Automatically (default): once per quiz session, when the shopper enters their email. If your quiz has no email step, or the shopper skips it, the Lead fires when results are shown instead.

  • When the email is captured: only at the email step.

  • When results are shown: only when the shopper completes the quiz.

  • Never: no standard Lead. You can still build a custom conversion on LanternQuizComplete (see below).

Send PageView when the quiz loads is on by default. If the quiz is embedded on a page where your theme's pixel already fires a PageView, you can turn it off to avoid counting the page twice.

Image showing the Lead event options and PageView setting for a quiz in Lantern Advanced Analytics.

The events Lantern sends

Meta event

When

Parameters

PageView

The quiz loads

-

LanternQuizStart (custom)

The shopper clicks Start

quiz_id, quiz_name

Lead

Per the setting above

quiz_id, quiz_name

LanternQuizComplete (custom)

Results are shown

quiz_id, quiz_name, content_ids (recommended product ids), content_type

AddToCart

A product is added to the cart from the results

content_ids (variant id), content_type, content_name, value, currency

ViewContent

A recommended product is clicked

content_ids, content_type, content_name, value, currency

Every event carries a unique event ID, so the Conversions API integration can deduplicate browser and server events.

Step 4: Test it

4.1 In Events Manager, open your pixel and go to the Test events tab.

4.2 Enter your quiz URL (you'll find it on the quiz's Publish page) and click Test events.

4.3 Take the quiz. You should see PageView, LanternQuizStart, Lead and LanternQuizComplete appear as you go.

Image showing the Test events tab in Meta Events Manager with a quiz URL entered, the Test Events button, and quiz events received below, including PageView, Lead, and LanternQuizComplete.

The Meta Pixel Helper browser extension works too. It lists the events as they fire while you take the quiz.

Using the events in Meta Ads

  • Optimize for quiz completions: in Events Manager, go to Custom conversions and create one based on the LanternQuizComplete event. You can then pick it as the conversion event of a campaign.

  • Retarget quiz takers: build a custom audience from people who triggered LanternQuizStart but not LanternQuizComplete, or from LanternQuizComplete with specific content_ids.

  • Lead campaigns: use the standard Lead event with the "Automatically" setting.

What is not sent

Lantern never sends quiz answers to Meta. The events only contain the quiz, the step reached and the recommended product ids. To help Meta match the visit to the shopper's account (advanced matching), the email, phone number, first name and last name they enter on the Optin Page are sent hashed (scrambled before they leave the browser or our server), never as plain text. Answers from questions set to Don't share or Don't store never reach any third party. Learn more about Sensitive Data Controls.

For developers: Shopify customer events

The same moments are also published as Shopify customer events, whether or not a Pixel ID is set, so a custom pixel in Settings > Customer events can react to them: lantern_quiz_started, lantern_lead_captured, lantern_quiz_completed (with product_ids) and lantern_add_to_cart (with content_ids, value, currency). Each carries quiz_id, quiz_name and lantern_session_id.

For an example custom pixel that subscribes to these events, and to send quiz events to other tools such as Google Tag Manager, Google Ads, Microsoft Clarity, Northbeam or your own scripts, see Track quiz events with your own tools.

If something doesn't show up, write to us from the app and we'll take a look together.

Did this answer your question?