Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
import { useLinkQuery, usePixelQuery, useWebsiteQuery } from '@/components/hooks';
import type { BoardEntityType } from '@/lib/boards';
export function useBoardEntityBadgeProps(
entityType?: BoardEntityType,
entityId?: string,
enabled = true,
) {
const { data: website } = useWebsiteQuery(
enabled && entityType === 'website' ? entityId : undefined,
);
const { data: pixel } = usePixelQuery(enabled && entityType === 'pixel' ? entityId : undefined);
const { data: link } = useLinkQuery(enabled && entityType === 'link' ? entityId : undefined);
if (entityType === 'website' && website?.name) {
return { type: entityType, name: website.name, domain: website.domain ?? undefined };
}
if (entityType === 'pixel' && pixel?.name) {
return { type: entityType, name: pixel.name };
}
if (entityType === 'link' && link?.name) {
return { type: entityType, name: link.name };
}
return null;
}