Importing a custom CS to call a pixel fire function on.

chimanrao
Shopify Partner
1 0 0

Is it possible to import a Javascript file into each page:

 

 

<script src='https://www.other_site.com/the_script.js"/>

 

 

 

and then use the following code to fire a pixel function located inside "the_script.js" by setting it up in the Settings --> Customer Events section?

 

 

analytics.subscribe("checkout_completed", event => {
   THE_SCRIPT_OBJ.firePixel();
}

 

 

I understand that liquid files are going to be deprecated, so I was looking for a method to do this without editing liquid files.

 

I've tried downloading the remote file "the_script.js", and adding it to the Assets folder. I expected it will be available as soon as the site loads, but that didn't work.

 

I tried editing the liquid file (Though I dont want to do this), but that also didn't work:

 

 

{{ "the_script.js" | asset_url | script_tag }}

 

 

 

Replies 0 (0)