{{-- Facebook Pixel + Meta CAPI, GA4, Google Ads, GTM, TikTok, Custom.
Each block only renders if the admin has switched it on in
Admin > Tracking. Every event fires with a shared event_id passed to
both the Pixel call (here) and our /api/track/event endpoint (server
CAPI relay) so Meta can dedupe browser + server events. --}}
@php
$meta = $trackingSettings['meta'] ?? null;
$ga4 = $trackingSettings['ga4'] ?? null;
$gtm = $trackingSettings['gtm'] ?? null;
$tiktok = $trackingSettings['tiktok'] ?? null;
$custom = $trackingSettings['custom'] ?? null;
@endphp
@if($gtm && $gtm->is_active && !empty($gtm->config['gtm_id']))
@endif
@if($ga4 && $ga4->is_active && !empty($ga4->config['measurement_id']))
@endif
@if($tiktok && $tiktok->is_active && !empty($tiktok->config['pixel_id']))
@endif
@if($custom && $custom->is_active && !empty($custom->config['script']))
{!! $custom->config['script'] !!}
@endif
@if($meta && $meta->is_active && !empty($meta->config['pixel_id']))
@else
@endif