'use client';
import Head from "next/head";
import { useEffect } from "react";

const pixelId = "2022420848247834";

const MetaPixel: React.FC = () => {
    useEffect(() => {
        import("react-facebook-pixel").then(module => module.default).then(
            ReactPixel => {
                ReactPixel.init(pixelId);
                ReactPixel.pageView()
            }
        )
    }, []);

    return (
        <Head>
            <noscript>
                <img
                    height="1"
                    width="1"
                    style={{ display: "none" }}
                    src="https://www.facebook.com/tr?id=2022420848247834&ev=PageView&noscript=1"
                />
            </noscript>
        </Head>
    );
}

export default MetaPixel;