mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-15 10:43:07 +00:00
Let marketing configure a numeric facebookPixelId per petition in Payload, fire PageView on load and Lead after a successful signature, and mark the roadmap item delivered with deferred follow-ups documented.
31 lines
886 B
TypeScript
31 lines
886 B
TypeScript
'use client'
|
|
|
|
import Script from 'next/script'
|
|
|
|
export const MetaPixel = ({ pixelId }: { pixelId: string }) => (
|
|
<>
|
|
<Script id={`meta-pixel-${pixelId}`} strategy="afterInteractive">
|
|
{`
|
|
!function(f,b,e,v,n,t,s)
|
|
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
|
|
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
|
|
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
|
|
n.queue=[];t=b.createElement(e);t.async=!0;
|
|
t.src=v;s=b.getElementsByTagName(e)[0];
|
|
s.parentNode.insertBefore(t,s)}(window, document,'script',
|
|
'https://connect.facebook.net/en_US/fbevents.js');
|
|
fbq('init', '${pixelId}');
|
|
fbq('track', 'PageView');
|
|
`}
|
|
</Script>
|
|
<noscript>
|
|
<img
|
|
alt=""
|
|
height="1"
|
|
width="1"
|
|
style={{ display: 'none' }}
|
|
src={`https://www.facebook.com/tr?id=${pixelId}&ev=PageView&noscript=1`}
|
|
/>
|
|
</noscript>
|
|
</>
|
|
)
|