This usually happens when the script code is not correctly embedded within your Shopify store's HTML. To ensure your scripts run properly and do not show as plain text, you need to wrap them in <script> tags.
Make sure your script is placed within <script> tags. For example, if you are adding Google Tag Manager, your code should look like this:
<!-- Google Tag Manager -->
<script>
(function(w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({
'gtm.start': new Date().getTime(),
event: 'gtm.js'
});
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-XXXX');
</script>
<!-- End Google Tag Manager -->
After inserting the script, preview your site to ensure everything works as expected. If the script still appears as text, double-check for typos or missing tags.
More in Insert Code FAQs
- Does Custom Code Inserter SGTLab work with my theme?
- How will Custom Code Inserter SGTLab affect my page speed?
- Why add custom CSS in your store?
- Can I use a CSS preprocesor like LESS or Sass?
- Does the app modify the code I write in the editor?
- What if I change the theme?
- What if I want to add multiple external CSS codes?
- What will happen after I uninstall the app?