I have followed the below link and added the code in success.phtml
but my orders are not tracked in Google Analytics. In Chrome, the below error comes
https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce
success.phtml
<script type="text/javascript">
ga('create', '<?php echo Mage::getStoreConfig('google/analytics/account') ?>');
ga('require', 'ec');
<?php
foreach ($items as &$item) {
echo $block->getItemJs($trans['id'], $item);
}
echo $block->getTransactionJs($trans);
?>
ga('send', 'pageview');
</script>
Uncaught ReferenceError: ga is not defined
Can anyone help me,?