<?php

namespace App\Hooks\Tracking;

use App\Core\Hook\AbstractHook;
use App\Core\Hook\HookManager;

class Ga4Hook extends AbstractHook
{
    public function boot(HookManager $hooks): void
    {
        $hooks->listen('ClientAreaHeadOutput', function () {
            $id = setting('ga4_measurement_id');
            if (empty($id)) {
                return '';
            }
            return view('hooks.tracking.ga4', ['measurement_id' => $id])->render();
        }, priority: 20, category: 'marketing');
    }
}
