Skip to content

Meta Pixel: option to skip the automatic PageView (like TikTok's trackPageView)聽#929

Description

@felixgabler

馃啋 Your use case

Thanks again for Nuxt Scripts. We send Meta PageView events from both the browser pixel and the Conversions API and want Meta to deduplicate them, which needs the same eventID on both.

useScriptMetaPixel always queues fbq('track', 'PageView') in clientInit. fbevents keeps only the first PageView per pixel on a page, so our own fbq('track', 'PageView', {}, { eventID }) is dropped, and the browser event never carries the ID.

馃啎 The solution you'd like

A trackPageView option on the Meta Pixel registry, like the TikTok Pixel one, defaulting to true:

const { proxy } = useScriptMetaPixel({ id: 'YOUR_PIXEL_ID', trackPageView: false })
proxy.fbq('track', 'PageView', {}, { eventID: 'shared-with-capi' })

馃攳 Alternatives you've considered

  • fbq('set', 'autoConfig', false, id) and fbq.disablePushState = true cover fbevents' automatic events and SPA history page views, not the PageView the stub queues.
  • Removing the queued PageView from window.fbq.queue ourselves works, but it depends on the stub's internals.

鈩癸笍 Additional info

We have a small PR ready (option, docs section, registry types, and a test) if this sounds reasonable.

I investigated this with help from an AI coding assistant (Claude Code), which also drafted this text. I reviewed it, and the results above come from real runs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions