Hi, I added the Google Analytics script in my theme preferences as per Shopify guidelines.
I would like to execute Google Analytics `gtag` function from the theme code. Specifically I DON'T WANT/NEED to use the "Additional Google Analytics Javascript" text area. It sucks.
How can I refer to the Google Analytics `gtag` instance from within the code? I tried to add it to `window`, i.e. `window.gtag`, with no luck. To be honest I was expecting this to be already available to the `window` object.
How do I access the `gtag` from within my code?
User | Count |
---|---|
25 | |
22 | |
22 | |
19 | |
12 |