Skip to content

Commit

Permalink
Fixes Smile-SA#1321 Prevent js errors if tracker blocked
Browse files Browse the repository at this point in the history
by browser plugin (ex: ublock origin)
  • Loading branch information
rbayet committed Feb 27, 2019
1 parent 145711f commit 4e97e99
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<?php if ($block->isEnabled()) : ?>
<script type="text/javascript">
//<![CDATA[
try {
smileTracker.setConfig({
beaconUrl : '<?= /* @noEscape */ $this->escapeJsQuote($block->getBeaconUrl()); ?>',
sessionConfig : <?= /* @noEscape */ $jsonHelper->jsonEncode($block->getCookieConfig()); ?>,
Expand All @@ -31,6 +32,9 @@
smileTracker.sendTag();
}
});
} catch (err) {
;
}
//]]>
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
<?php if ($block->isEnabled() && !empty($variables)) : ?>
<script type="text/javascript">
<!--
try {
<?php foreach ($variables as $varName => $value) : ?>
smileTracker.addPageVar('<?php /* @noEscape */ echo $this->escapeJsQuote($varName)?>', '<?php /* @noEscape */ echo $block->stripTags($this->escapeJsQuote($value), null, true) ?>')
<?php endforeach; ?>
} catch (err) {
;
}
//-->
</script>
<?php endif; ?>

0 comments on commit 4e97e99

Please sign in to comment.