UNPKG

next-facebook-tracking

Version:

A simple package to help you integrate Facebook Pixel and Conversions API with Next.js

42 lines (39 loc) 1.08 kB
import * as react_jsx_runtime from 'react/jsx-runtime'; import { Facebook } from '../types.js'; /** * The provider for the FacebookPixel component. * * @param children - The child components. * @returns The FacebookPixelProvider component. */ declare const FacebookPixelProvider: ({ children, pixelId, debug, }: { children: React.ReactNode; pixelId?: string; debug?: boolean; }) => react_jsx_runtime.JSX.Element; declare global { interface Window { fbq: (...args: any[]) => void; } } /** * Custom hook to access the FacebookPixel context. * * @returns The FacebookPixel context. */ declare function useFacebookPixel(): { /** * Sends a custom event to Facebook Pixel. */ track<T extends Facebook.Event.EventName>(event: Facebook.Event.EventDataBrowser<T>): void; /** * Grants consent to Facebook Pixel. */ grantConsent(): void; /** * Revokes consent to Facebook Pixel. */ revokeConsent(): void; init(pixelId: string): void; } | null; export { FacebookPixelProvider, useFacebookPixel };