Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

154
Views
Send Stock Status Events to Google Analytics from Shopify

I'm trying to send stock status events onto Google Analytics to measure how many out of stock items are being viewed compared to in stock products.

Here is the snippet of liquid

<!--Stock Status event Sender -->

{% if product.selected_variant.available == true %}
  <script>ga('send', 'event', { eventCategory: 'Stock Status', eventAction: 'In Stock Product View'});</script>
{% else %}
<script>ga('send', 'event', { eventCategory: 'Stock Status', eventAction: 'Out of Stock Product View'});</script>
{% endif %}
<!-- End of Stock Status event Sender -->

All results are returning as 'Out of Stock Product View'

Questions:

Is the above correct?

How to I get it to fire the script again if a user selects another variant on the page? A URL parameter gets added e.g ?variant=40014584709205 - Does this count as new page firing?

Looking at current behaviour in GA - it seems to be recording the first event on product view in a session but not again when user browses another product.

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!