← Back to all blogs← Previous article

Identity stitching: how anonymous visits become a customer

Most tracking treats every anonymous visit as a dead end. Identity stitching links months of browsing to a real customer the moment they identify.

The anonymous visitor problem

A potential customer finds your brand via a TikTok ad. They browse three products, add one to cart, then close the tab. Three days later they return directly and browse two more products. A week after that they Google your brand, read a review, and purchase. How many visits does your tracking attribute to this purchase? Usually one, the last click.

Everything before the final visit is invisible. The TikTok ad that introduced them gets no credit. Product pages they browsed do not inform retargeting. Cart abandonment stays unlinked to the eventual purchase. That is the anonymous visitor problem, and it affects every Shopify store.

What identity stitching is

Identity stitching links anonymous session data to a known customer profile, retroactively. When a visitor identifies (by purchasing, signing up, or entering an email), Layer Insights connects that identity to previous anonymous sessions from the same browser.

The mechanism uses a first-party cookie called _lf_id, set on the first visit and kept for 400 days. It persists across sessions, incognito windows on the same browser, and theme changes. When the visitor identifies, every event on that _lf_id is linked to their customer profile.

Stitching only runs when a customer explicitly provides an email. Layer Insights never infers identity.

What happens when a visitor identifies

The moment a customer enters their email, at checkout, in a newsletter popup, or via a quiz, Layer Insights runs an identify call. It updates the sessions table to link _lf_id to email and Shopify customer ID. It retroactively enriches past events for that _lf_id. For events still inside an ad platform attribution window, it re-queues those events for CAPI dispatch with the newly available PII, which improves EMQ on events that were sent anonymously.

Why this matters for your ad platforms

Meta’s attribution window is 7 days. If a customer browsed a product 5 days ago while anonymous, and purchases today, Layer Insights can re-send that ViewContent event to Meta CAPI with the hashed email, upgrading a low-EMQ anonymous event to a high-EMQ identified event.

Google’s Enhanced Conversions window is 90 days. Historical events going back three months can be enriched when a customer finally identifies.

400d
_lf_id lifetime
7d
Meta re-send window
90d
Google enrichment window

Privacy and GDPR

Identity stitching activates only when a customer provides their email. All PII is stored encrypted and transmitted as SHA-256 hashes to ad platforms. The _lf_id cookie is first-party on your domain. Disclose it in your privacy policy.

Layer Insights app

See the same decision in your own commerce data

Open Layer Insights →
Read next

How to improve your Meta ROAS with server-side tracking

Continue reading →