I recently created a module to add a google remarketing tag to a web store. I prepared google_tag_params for different types of pages (product, category, cart, etc.) According to the documentation. Everything went well until the client checked the page with the Google Tag Assistant add-on in Chrome. It shows a warning for the CDATA section. At first, I did not understand what he was talking about, since the parameters were fine, and I did not get any errors in the console. So I checked the Google Tag Assistant and, to my surprise, it works as follows.
For code:
<script type="text/javascript"> //<![CDATA[ var google_conversion_id = <?php echo $this->getConversionId();?>; var google_conversion_label = '<?php echo $this->getConversionLabel();?>'; var google_custom_params = window.google_tag_params; var google_remarketing_only = <?php echo $this->getRemarketingOnlyFlag();?>; //]]> </script>
It shows the warning โCDATA Missing Commentsโ and points to the documentation https://support.google.com/tagassistant/answer/2978937?ref_topic=2947092#cdata_comments
But changing it to
<script type="text/javascript"> var google_conversion_id = <?php echo $this->getConversionId();?>; var google_conversion_label = '<?php echo $this->getConversionLabel();?>'; var google_custom_params = window.google_tag_params; var google_remarketing_only = <?php echo $this->getRemarketingOnlyFlag();?>; /*]]> */ </script>
Raises a warning.
So my question is this. Is there any difference between online comments and multi-line comments in any browser? Is this just the weird behavior of a google tag helper that doesn't recognize these comments?
source share