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

Function Pixels

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

Source from the content-addressed store, hash-verified

424};
425
426export const Pixels = (): ReactElement => {
427 const { cookieExists: acceptedMarketing } = useConsentCookie(
428 GdprConsentKey.Marketing,
429 );
430 const { user, anonymous, isAuthReady, isGdprCovered } = useAuthContext();
431 const userId = user?.id || anonymous?.id;
432
433 const { query, pathname, isReady } = useRouter();
434 const instanceId = query?.aiid?.toString();
435
436 const consent = !isGdprCovered || acceptedMarketing;
437 const props: PixelProps = { userId, instanceId, consent, email: user?.email };
438
439 // The query check needs `isReady`: on static pages `query` is empty until
440 // then, and once a pixel script mounts it stays loaded and reports the full
441 // URL, sensitive params included.
442 if (
443 !isProduction ||
444 !userId ||
445 !isAuthReady ||
446 !isReady ||
447 isSensitivePage(pathname) ||
448 hasSensitiveQueryParam(query)
449 ) {
450 return null;
451 }
452
453 return (
454 <>
455 <FbTracking {...props} />
456 <GtagTracking {...props} />
457 {consent && (
458 <>
459 <TiktokTracking />
460 <TwitterTracking />
461 <RedditTracking />
462 <QuoraTracking />
463 </>
464 )}
465 </>
466 );
467};

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