@adkit.so/meta-pixel-next
Version:
Next.js integration for Meta Pixel tracking - auto PageView on route changes
45 lines (42 loc) • 1.48 kB
TypeScript
import * as react_jsx_runtime from 'react/jsx-runtime';
import { ReactNode } from 'react';
export { EventData, EventMetaData, MetaPixelConfig, MetaPixelInterface, MetaPixelProvider, StandardEvent, initMetaPixel, useMetaPixel } from '@adkit.so/meta-pixel-react';
interface MetaPixelProps {
/** Your Meta Pixel ID(s). Can also use NEXT_PUBLIC_META_PIXEL_ID env var */
pixelId?: string | string[];
/** Enable debug logging to console (default: false) */
debug?: boolean;
/** Enable tracking on localhost (default: false) */
enableLocalhost?: boolean;
/** Auto track PageView on route changes (default: true) */
trackPageViews?: boolean;
/** Children to render */
children?: ReactNode;
}
/**
* Meta Pixel component for Next.js
*
* Features:
* - Auto tracks PageView on initial load
* - Auto tracks PageView on route changes (App Router)
* - Supports environment variable NEXT_PUBLIC_META_PIXEL_ID
*
* @example
* // app/layout.tsx
* import { MetaPixel } from '@adkit.so/meta-pixel-next'
*
* export default function Layout({ children }) {
* return (
* <html>
* <body>
* <MetaPixel pixelId="123456789" debug={true}>
* {children}
* </MetaPixel>
* </body>
* </html>
* )
* }
*/
declare function MetaPixel({ pixelId, debug, enableLocalhost, trackPageViews, children, }: MetaPixelProps): react_jsx_runtime.JSX.Element;
export { MetaPixel };
export type { MetaPixelProps };