PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, June 30, 2022

[FIXED] How to add a script tag to shopify directly to the html source?

 June 30, 2022     javascript, php, shopify     No comments   

Issue

This plugin for shopify: https://apps.shopify.com/custom-js

It used to allow you to add a full script tag to the html.

But today a client was complaining saying it did not work for them, when i dug into the issue the plugin appears to have stopped doing that and only allow you to add actual javascript code.

They don't want to use google tag manager, but we need a simple way (that they can understand in the future when i am not there) to be able to inject custom script tags.

EG:

<script src="https://some-review-service.com/loader.js"></script>

Any help would be hugely helpful as I am by no means a shopify guru :)


Solution

Use this code in theme.liquid if you are using third party js file:

{{ 'https://some-review-service.com/loader.js' | script_tag }}

Otherwise, upload loader.js file in the assets folder. and add the below code in your theme.liquid head section:

{{ 'loader.js' | asset_url | script_tag }}


Answered By - Manisha Thakur
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing