MCPcopy Create free account
hub / github.com/dailydotdev/apps / Pixels

Function Pixels

packages/webapp/components/Pixels.tsx:471–512  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

469};
470
471export const Pixels = (): ReactElement => {
472 const { cookieExists: acceptedMarketing } = useConsentCookie(
473 GdprConsentKey.Marketing,
474 );
475 const { user, anonymous, isAuthReady, isGdprCovered } = useAuthContext();
476 const userId = user?.id || anonymous?.id;
477
478 const { query, pathname, isReady } = useRouter();
479 const instanceId = query?.aiid?.toString();
480
481 const consent = !isGdprCovered || acceptedMarketing;
482 const props: PixelProps = { userId, instanceId, consent, email: user?.email };
483
484 // The query check needs `isReady`: on static pages `query` is empty until
485 // then, and once a pixel script mounts it stays loaded and reports the full
486 // URL, sensitive params included.
487 if (
488 !isProduction ||
489 !userId ||
490 !isAuthReady ||
491 !isReady ||
492 isSensitivePage(pathname) ||
493 hasSensitiveQueryParam(query)
494 ) {
495 return null;
496 }
497
498 return (
499 <>
500 <FbTracking {...props} />
501 <GtagTracking {...props} />
502 {consent && (
503 <>
504 <TiktokTracking />
505 <TwitterTracking />
506 <RedditTracking />
507 <QuoraTracking />
508 </>
509 )}
510 </>
511 );
512};

Callers

nothing calls this directly

Calls 5

useConsentCookieFunction · 0.90
useAuthContextFunction · 0.90
isSensitivePageFunction · 0.90
hasSensitiveQueryParamFunction · 0.90
useRouterFunction · 0.50

Tested by

no test coverage detected