How can I show a number of people 'viewing' a product on my site?

Topic summary

Displaying a live “people viewing” count on product pages; a user couldn’t get an older code snippet working with Shopify’s Dawn or Shrine themes and sought a custom-code alternative, even with random numbers.

A responder cautioned that showing random viewers is misleading and suggested using the free Trafficly – Visitors Counter app instead.

The original poster noted the thread still draws attention a year later.

Another participant warned that faking viewer counts is deceptive, risks deplatforming, and may violate consumer-protection laws; they called the referenced solution fake and potentially fraudulent.

Shopify’s TOS requires accurate claims about product popularity and availability, citing examples like limited stock notices, countdown timers, and buyer counts; the examples are non-exhaustive, covering fabricated viewer numbers.

Technical notes: Dawn and Shrine are Shopify themes; a genuine live counter typically needs a backend app and real data; FOMO tactics should avoid dark patterns.

Outcome: no compliant custom-code fix was provided; the advised action is to use an app that tracks real visitors; the discussion is unresolved but leans against random-number counters.

Summarized with AI on December 10. AI used: gpt-5.

I recently tried to copy the code from the top answer on this post "https://community.shopify.com/c/shopify-apps/how-can-i-show-the-number-of-people-viewing-a-product-on-my-site/td-p/1043345" but it seems to be either outdated or doesn’t work with Dawn or Shrine theme? I am trying to stay away from apps as much as I can so I am looking for custom code alternatives. I would like to have the live counter, even just random numbers 3, 10, 23, etc.

Any answers would be greatly appreciated.

Hi Timecom,

Showing a random number of people viewing a product would be misleading to customers so I wouldn’t recommend that strategy. The Trafficly ‑ Visitors Counter app is free, have you tested this out?

People still look at this thread 1 year on? Thanks lol.

@Timecom @Liam gave the legimate answer.
You can get your store deplatformed faking numbers like this.
A keyword for business risk is : deceptive

Yes people will look when they search for hard to solve problems like this because it needs a backend app to do properly and above board without possible legal issues.

The post you’ve marked is not an actual solution, it’s FAKE if not outright fraud or illegal in some regions under pro consumer laws against misrepresentation and anti-consumer dark patterns.
And then it has the gall to charge for code that just changes a FAKE number to present to customers when merchants could probably just ask the built in section/block generator to make this for free.

Violating shopify’s TOS:

Claims about product popularity and availability should be clear and accurate. Potentially deceptive or misleading marketing include the following examples:

Examples are NON-EXHAUSTIVE, meaning just because your specific random number dispaly is not in the examples that doesn’t mean the rules don’t apply to you or other merchants faking numbers.

Walk very carefully when doing FOMO patterns like this as it’s incredibly easy to be lazy and take the scummy route of fake numbers and not use REAL data.

Probably just need to get this thread nuked at this point.