How to add a visitor counter to Shopify

On Shopify the code goes into your theme's main layout file, so it loads on every storefront page. It takes about three minutes.

Add the code to your theme

In Shopify admin open Online Store, then Themes. Next to your live theme open the … menu and choose Edit code. Under Layout, open theme.liquid, find </head> and paste your BYOViral tracking code (in the dashboard, open Websites, choose your site and press Edit; the code is at the bottom of the page) just above it. Press Save.

Before you edit

Duplicate the theme first from the same menu. If anything goes wrong, you can switch back in one click.

What it covers

Home, collection, product, cart, blog and other storefront pages. Shopify's checkout is separate from your theme, so checkout steps are not counted by this code.

After a theme change

The code lives in the theme. If you install or switch to a new theme, add it again to the new theme.liquid.

Check that it works

Open the store in a private window (or with the storefront password if the store is not launched yet) and check the Realtime report.

Frequently asked questions

Will it slow the store down?

No. The script is under 1 KB and loads asynchronously.

Does Shopify's cookie banner affect it?

BYOViral sets no cookies, so it does not depend on Shopify's customer privacy banner. Your other apps may.

Can I see which products get the most views?

Yes. The Pages report lists product URLs by pageviews.

Try BYOViral free

Privacy-first analytics with no cookies and a real free tier.

Create your free account →