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

Function Pixels

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

Source from the content-addressed store, hash-verified

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

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