feat(third-parties): add Meta Pixel integration with helper #79005
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
This PR adds a new
MetaPixel
component to the experimental@next/third-parties
package, making it easy to integrate the Meta (Facebook) Pixel into Next.js applications.In addition, it introduces the
sendMetaPixelEvent
helper function, allowing developers to dynamically track standard and custom events after initialization.Documentation has been fully updated to include usage examples, options, and supported events.
Why?
The Meta Pixel is one of the most widely used tracking pixels for marketing, yet it was missing from the current
@next/third-parties
package. This addition brings it in line with other popular integrations (such as Google Tag Manager and Google Analytics) and offers developers a first-class way to implement Meta Pixel in a performant, Next.js-optimized way.It also aligns with the goals of the package to offer pre-built, optimized third-party integrations that are easy to use.
How?
MetaPixel
component to@next/third-parties/meta
.sendMetaPixelEvent
utility function to enable dynamic event tracking.next/script
to optimize performance and defer loading until after hydration.third-parties
docs.