<?php
    $metaPixelEnabled = (bool) ($marketingSettings['meta_pixel_enabled'] ?? false);
    $metaPixelId = trim((string) ($marketingSettings['meta_pixel_id'] ?? ''));
?>

<?php if($metaPixelEnabled && $metaPixelId !== ''): ?>
    <script>
        !function(f,b,e,v,n,t,s)
        {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
        n.callMethod.apply(n,arguments):n.queue.push(arguments)};
        if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
        n.queue=[];t=b.createElement(e);t.async=!0;
        t.src=v;s=b.getElementsByTagName(e)[0];
        s.parentNode.insertBefore(t,s)}(window, document,'script',
        'https://connect.facebook.net/en_US/fbevents.js');
        fbq('init', '<?php echo e($metaPixelId); ?>');
        fbq('track', 'PageView');

        window.gpsTrackMeta = function (eventName, params) {
            if (typeof window.fbq !== 'function' || ! eventName) {
                return;
            }

            window.fbq('track', eventName, params || {});
        };
    </script>
    <noscript>
        <img height="1" width="1" style="display:none"
             src="https://www.facebook.com/tr?id=<?php echo e(urlencode($metaPixelId)); ?>&ev=PageView&noscript=1"
             alt="">
    </noscript>
<?php endif; ?>
<?php /**PATH C:\xampp\htdocs\gps-migration\resources\views/partials/meta-pixel-assets.blade.php ENDPATH**/ ?>