How can I capture custom events using Rudderstack?

Topic summary

A user is attempting to integrate Growthbook with Rudderstack for event tracking on their Shopify store. They’ve added a custom event in their theme.liquid file following Growthbook’s script-tag documentation.

Current Issue:

  • Custom events are not being captured
  • Error indicates the rudderanalytics object is undefined at the time the call is invoked

Key Question:

  • Which JavaScript file should contain the code to properly initialize the Rudderstack object before custom event calls are made

The discussion appears to be seeking technical guidance on proper implementation order and file placement for the Rudderstack integration.

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

Dear Community

I am trying to set-up and experiment using Growthbook and capturing events using Rudderstack.

Have added a custom event in theme-liquid.

Based on this https://docs.growthbook.io/lib/script-tag
However the custom events is not captured.


The error is that the object rudderanalytics is not defined at time of invocation of the call.
Which javascript file should this code snippet live?