We are using google analytics in our website but getting below error in console. Error: Uncaught SyntaxError: Unexpected token ':'
Script:
<script type="text/x-magento-init">
{
"*": {
"Magento_GoogleAnalytics/js/google-analytics": {
"isCookieRestrictionModeEnabled": <?= (int)$block->isCookieRestrictionModeEnabled() ?>,
"currentWebsite": <?= (int)$block->getCurrentWebsiteId() ?>,
"cookieName": "<?= /* @escapeNotVerified */ \Magento\Cookie\Helper\Cookie::IS_USER_ALLOWED_SAVE_COOKIE ?>",
"ordersTrackingData": <?= /* @escapeNotVerified */ json_encode($block->getOrdersTrackingData()) ?>,
"pageTrackingData": <?= /* @escapeNotVerified */ json_encode($block->getPageTrackingData($accountId)) ?>
}
}
}
</script>
1 Answer 1
Not sure of the answer, but interestingly the syntax highlighting detects a change when it comes to the OrdersTrackingData, all the other keys are green, but this shows black. Could you maybe try removing this line, or the one above it and see if the error still occurs?
Explore related questions
See similar questions with these tags.