Importing a custom CS to call a pixel fire function on

Topic summary

A developer is trying to import a custom JavaScript file (the_script.js) into their Shopify store pages to call a pixel firing function through the Customer Events section in Settings.

Attempted Solutions (both unsuccessful):

  • Downloading the remote JavaScript file and adding it to the Assets folder, expecting it to be available when the site loads
  • Editing the liquid file directly (though they prefer to avoid this approach)

Core Challenge:
They want to use analytics.subscribe("checkout_completed") to trigger THE_SCRIPT_OBJ.firePixel() from their custom script, but need a method that doesn’t require editing liquid files—especially since liquid files are being deprecated.

Current Status:
The question remains unanswered with no working solution identified for importing and accessing the custom JavaScript in the Customer Events context.

Summarized with AI on November 10. AI used: claude-sonnet-4-5-20250929.

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


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?

```javascript
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 }}