Skip to main content

Meta Pixel integration

Send quiz starts, leads, completions and add-to-carts from your Lantern quiz to Meta Ads with just your Pixel ID, no code to paste.

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. Open Meta Events Manager and go to Data sources.

  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.

  3. Copy it.

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

  1. In Lantern, open Advanced Analytics.

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

  3. Paste your Pixel ID next to each quiz you want to track, choose when the Lead event fires, and click Save & Finish Setup.

Option B: for one quiz, from the editor

  1. Click Edit Quiz and open the Settings tab.

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

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.

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 a future server-side (Conversions API) integration can deduplicate against it.

Step 4: Test it

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

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

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

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 the shopper's email, phone number, name or quiz answers to Meta. Only the quiz, the step reached and the recommended product ids. 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.

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

Did this answer your question?