Yarn 4 monorepo (packages/*) shipping two published packages:
meta-pixel— framework-agnostic, client-side only TypeScript wrapper around Meta'sfbevents.js. Builds withtsctolib/(not committed). CJS (main/types), noexportsfield.nuxt-meta-pixel— Nuxt 3 module wrappingmeta-pixel. Built with@nuxt/module-buildertodist/(ESM).
- Goal: keep both packages fully functional on Nuxt 3.
- One PR per fix by default (small, focused branches off
dev) — not catch-all branches. devis the integration/PR base branch; feature branches merge into it.- Released via
changelogen(npm run releasein each package); bumpmeta-pixelbefore the dependentnuxt-meta-pixel. - Toolchain pinned via Volta (Node 22.15.0, Yarn 4.2.1).
fbq('set', 'autoConfig', <boolean>, <pixelId>)— boolean before pixel id.consentis global (takes no pixel id): applies to every pixel. Must berevoked beforeinit, and re-revoked on every page load.'grant'is runtime-only (tracking is on by default), so it's not a valid config value.- Advanced matching fields are all strings — including digit-only
ph(e.g.'16505554444') anddb(YYYYMMDD, e.g.'19910526'). contentsis an array of{ id, quantity }(key isid, notname).Purchaseis the only standard event that requirescurrency+value.- CAPI deduplication:
eventIDis the 4th positional arg —fbq('track', 'Purchase', {...}, { eventID }). pageViewglobs use the in-houseruntime/glob.ts, not minimatch — only**,*,?, leading!are supported (no{a,b}/[abc]). It replaced minimatch to dodge abrace-expansionESM crash in Vite dev (#14, #20).
# meta-pixel
cd packages/meta-pixel && yarn build # tsc --build
# nuxt-meta-pixel
cd packages/nuxt-meta-pixel
npm run dev:prepare # generate type stubs (run first)
npm run dev # playground
npm run lint # eslint
npm run test # vitest run- Pixel events & parameters: https://developers.facebook.com/docs/meta-pixel/reference
- Advanced matching: https://developers.facebook.com/docs/meta-pixel/advanced/advanced-matching
- autoConfig / advanced: https://developers.facebook.com/docs/meta-pixel/advanced
- GDPR consent: https://developers.facebook.com/docs/meta-pixel/implementation/gdpr
- trackSingle (multi-pixel): https://developers.facebook.com/ads/blog/post/v2/2017/11/28/event-tracking-with-multiple-pixels-tracksingle/