Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ga.phtml
Go to the documentation of this file.
1 <?php
7 // @codingStandardsIgnoreFile
8 
9 ?>
10 <?php ?>
11 <?php $accountId = $block->getConfig(\Magento\GoogleAnalytics\Helper\Data::XML_PATH_ACCOUNT) ?>
12 <!-- BEGIN GOOGLE ANALYTICS CODE -->
13 <script type="text/x-magento-init">
14 {
15  "*": {
16  "Magento_GoogleAnalytics/js/google-analytics": {
17  "isCookieRestrictionModeEnabled": <?= (int)$block->isCookieRestrictionModeEnabled() ?>,
18  "currentWebsite": <?= (int)$block->getCurrentWebsiteId() ?>,
19  "cookieName": "<?= /* @escapeNotVerified */ \Magento\Cookie\Helper\Cookie::IS_USER_ALLOWED_SAVE_COOKIE ?>",
20  "ordersTrackingData": <?= /* @escapeNotVerified */ json_encode($block->getOrdersTrackingData()) ?>,
21  "pageTrackingData": <?= /* @escapeNotVerified */ json_encode($block->getPageTrackingData($accountId)) ?>
22  }
23  }
24 }
25 </script>
26 <!-- END GOOGLE ANALYTICS CODE -->
$block
Definition: block.php:8