Web Pixel ClientId

Topic summary

ClientId Basics:
Shopify’s clientId in web pixel events corresponds to the _shopify_y cookie and functions as a unique anonymous identifier per browser per device. It’s essentially a UUID with extremely low collision probability (one in several billion), so duplicate clientIds across different customers are virtually impossible.

Behavior & Limitations:

  • If two people share the same computer, browser, and session, they may share a clientId
  • The cookie expires after 1 year of inactivity; visiting after expiration generates a new clientId
  • Clearing cookies results in a new clientId being assigned on next page load
  • Shopify does not automatically merge clientIds

Customer Association:

  • One customer can have multiple clientIds (e.g., different devices, browsers, or after cookie expiration)
  • When a user authenticates (logs in or makes a purchase), you can associate their anonymous clientId with their customer ID
  • Merchants must implement their own tracking logic or use third-party apps/services to maintain associations between clientIds and customer IDs in a database

Key Distinction: Think of clientId as an anonymous device identifier, separate from authenticated customer IDs.

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

Hi shopify!

I’m reading the docs for shopify web pixel events and found that there’s a clientId field for each event type, and I am wondering will there ever be a duplicate clienId ever per store? for example will 2 customer ever share a common clientId, and will a customer gets a clientId that is “previously” used by another customer(so that customer clears the cookies/pixels and gets a new one)

Also lmk if my understanding is wrong: shopify creates customer data based on clientId, and if customer clears cookie/pixel, then shopify treats it as a new customer, and if these 2 customers shares common info then shopify will auto merge them into one customer?

Thanks!

Bear2024

1 Like

Shopify’s client id corresponds to the _shopify_y cookie (at the moment). It is per browser per device. It arrives from a Set-Cookie header when loading a page.

If two people use the same computer, the same browser, and in the same session, I think they can possibly get the same client id. Otherwise, because client id is basically a UUID, the probability that two users ever have the same value is something like one in several billion, so basically, no, two people will not have the same id.

Think of clientId as a unique anonymous id. It identifies an unknown person using a particular browser.

If someone clears the _shopify_y cookie then I think Shopify will generate a new one on the next page load. I do not think it is guaranteed to be the same as before.

The client id cookie has a 1 year expiration. I think it is extended on each page load. Therefore if someone visits, then does not visit for 365 days, then visits again (loads a new page), they will get assigned a new client id, because the cookie expired.

Shopify does not merge the client ids. However, if someone authenticates (e.g. makes a purchase and becomes a customer, or logs in), then you learn about their customer id. Then you can associate their anonymous client id with that customer id. In other words, each customer id might be associated with multiple client ids. For example, if I login from two different browsers (e.g. my phone and my laptop, or two different phone apps), or I login after a year in the same browser, then I have one customer id and two client ids.

It is best to think of client id like an anonymous device identifier.

You are on your own regarding how you associate one or more client ids with a customer id. There are many companies and programs and apps that help you with this, or you can write your own code that stores the associations of the two in a database. Or if you use pixels, some pixels will accept two ids, one being the anonymous id (the client id), and one being the user id (the customer id).

1 Like