Skip to content

Commit 6c2f9d4

Browse files
authored
Merge pull request #99 from camlafit/patch-1
Prevent error when GoogleAnalyticEnhancedECommerce is not set
2 parents bbf64d4 + bf1803d commit 6c2f9d4

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

views/templates/hook/ga_tag.tpl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121
{literal}
2222
<script type="text/javascript">
2323
document.addEventListener('DOMContentLoaded', function() {
24-
var MBG = GoogleAnalyticEnhancedECommerce;
25-
MBG.setCurrency('{/literal}{$isoCode|escape:'htmlall':'UTF-8'}{literal}');
26-
{/literal}{$jsCode nofilter}{literal}
24+
if (typeof GoogleAnalyticEnhancedECommerce !== 'undefined') {
25+
var MBG = GoogleAnalyticEnhancedECommerce;
26+
MBG.setCurrency('{/literal}{$isoCode|escape:'htmlall':'UTF-8'}{literal}');
27+
{/literal}{$jsCode nofilter}{literal}
28+
}
2729
});
2830
</script>
2931
{/literal}

0 commit comments

Comments
 (0)