All checks were successful
CI (PR) / checks (pull_request) Successful in 19m11s
PR Ready + auto-merge / ready-automerge (pull_request) Successful in 19m30s
Promote plan-issue Related on main merge / plan-issue-ready (pull_request) Has been skipped
Main merge flips claimed issues to done + in-prod / issue-done (pull_request) Successful in 8m12s
Campo tracking.facebookPixelId no global SiteSettings (mesma validação/normalização do precedente Petition, regra centralizada em facebookPixel.ts); home (grupo (home)) injeta o base code + PageView quando o ID está configurado (fail-closed) e o CampaignNewsletterForm dispara exatamente um Lead no sucesso do S9. Migration 20260819_213947_add_site_settings_facebook_pixel_id. Closes #94
15 lines
676 B
TypeScript
15 lines
676 B
TypeScript
import 'server-only'
|
|
|
|
import { normalizeFacebookPixelId } from '@/lib/facebookPixel'
|
|
import { getCachedGlobal } from '@/utilities/globalReads'
|
|
|
|
/**
|
|
* S10 — the Meta pixel configured in `SiteSettings.tracking` for the public
|
|
* campaign page. Cached under `global_site-settings`, so an admin edit of the
|
|
* global already revalidates the home (the `afterChange` hook busts the tag).
|
|
* Fail-closed: no configured ID → null → nothing renders on the page.
|
|
*/
|
|
export const getCampaignHomeMetaPixelId = async (): Promise<string | null> => {
|
|
const settings = await getCachedGlobal('site-settings')()
|
|
return normalizeFacebookPixelId(settings.tracking?.facebookPixelId)
|
|
}
|