<?php
/**
 * Copyright 2022 Adobe
 * All Rights Reserved.
 */
?>
<?php
/** @var \Magento\Framework\View\Element\Template $block */
/** @var \Magento\Framework\Escaper $escaper */
/** @var \Magento\GoogleGtag\ViewModel\Adwords $adsViewModel */

$adsViewModel = $block->getViewModel();
?>

<?php if ($adsViewModel->isGoogleAdwordsConfigurable() && $adsViewModel->isGoogleAdwordsActive()): ?>
    <?php $conversionId = $block->escapeHtml($adsViewModel->getConversionId()); ?>
    <?php $conversionLabel = $block->escapeHtml($adsViewModel->getConversionLabel()); ?>
    <?php $gtagSiteSrc = $adsViewModel->getConversionGtagGlobalSiteTagSrc(); ?>
    <!-- BEGIN GOOGLE ADWORDS CODE -->
    <script type="text/x-magento-init">
    {
        "*": {
            "Magento_GoogleGtag/js/google-adwords": {
                "conversionId": "<?= $block->escapeHtml($conversionId);  ?>",
                "gtagSiteSrc": "<?= $block->escapeHtml($gtagSiteSrc);  ?>",
                "conversionLabel": "<?= $block->escapeHtml($conversionLabel);  ?>"
            }
        }
    }
    </script>
    <!-- END GOOGLE ADWORDS CODE -->
<?php endif ?>
