What is returning visitor recognition?
Returning visitor recognition is identifying a device that has visited before and tying it to a known, trusted account, so you can shorten the experience for a genuine return instead of treating every visit as a first-time stranger. It is a convenience layer for personalization and friction removal, not an authentication gate. ShieldLabs surfaces two inputs for it, both already in every webhook: a durable DeviceID and a Risk Score (0-100). The DeviceID is server-derived from the browser environment rather than stored in a cookie, so it recognizes the same device across a cleared cookie, an incognito window, and an IP rotation — which is exactly where a cookie-only “remember me” falls apart. (The VisitorID resets whenever cookies clear, so it is the wrong handle for a return that survives a reset.) The Risk Score tells you the return is arriving on an ordinary, unmasked connection.This recognizes a device, not a person. It is a convenience signal, not a credential — read the guardrails at the end before wiring it to anything sensitive.
Recognize and reward a trusted device
The whole flow is one plain rule:- Input: a clean, low-anonymity session — a Clean-band Risk Score with an empty
signalsarray — arriving on aDeviceIDyou already tied to a verified account. - Rule: reward the return. Skip a redundant check, restore the visitor’s preferences, or shorten the path.
- Outcome: friction removed for a known-good return, with a safe fallback to your normal flow the moment either half of the input is missing.
signals array means no VPN, proxy, Tor, or mismatch fired. That is why you require an empty signals array, not just a low-ish score — a device on a fresh VPN can present a tidy-looking public_ip while its real network IP (local_ip) betrays the mask. When the two disagree, detection_flags.ip_mismatch is set to true, which your gate checks directly (see the code below). A fresh VPN or proxy also fires its own scored signal, lifting the visit out of the Clean band so the empty-signals gate catches it anyway.
Match on the band plus the DeviceID, never the DeviceID alone. A returning device with a Medium or High score is a returning device on a riskier connection, and the riskier connection is the part that should drive your decision.
Build it
ShieldLabs surfaces the clean session and the DeviceID; your code builds the trust list and decides which friction to remove.Identify on the page
Load the snippet where the return matters — a returning visitor landing on your app or starting a routine action. Keep the
requestID to join the browser check to the webhook.Associate a DeviceID with a trusted account
Recognition only works once you have something to recognize. Whenever a visitor completes a real, authenticated action you trust (a login behind your own auth, a verified purchase, an email confirmation), store the DeviceID that arrived on that visit against that account. Over time each account accumulates a small set of devices it has genuinely used.
Build the trust list on a verified action
Recognize the return
On the next visit, wait briefly for the score, then check the band and the device together. A clean score on its own is an ordinary visit; a known DeviceID on its own is not enough either. The recognition is the intersection.
api/enter.js
waitForScore is the shared webhook-cache read (poll the cache, then fall back to a History API read by request_id); the Use Case Tutorials index defines it once, so this tutorial does not repeat it.Lighten the experience
For a recognized return, remove friction. A few safe places to spend it:
- Skip a redundant check. A second-factor prompt the same trusted device already cleared this week can be relaxed, while staying on for anything sensitive.
- Restore preferences. Re-apply the visitor’s layout, language, or saved cart before they ask.
- Shorten the path. Pre-fill what you already know, or drop the visitor straight onto the screen they last used.
- Soften rate limits. A recognized device earns more headroom than an anonymous one on the same endpoint.
Test it
Confirm recognition holds across the exact resets a cookie-only approach loses to. Visit once on a clean connection, let the visit land against a trusted account, then come back:- Clear cookies and storage, reload, and identify again. The
cookie_idandvisitor_idchange, but thedevice_idstays the same. - Open an incognito or private window in the same browser and identify. A fresh cookie context still resolves to the same
device_id. - Reconnect on a different network (Wi-Fi to mobile data). The IP rotates, the
device_iddoes not.
signals array and the same device_id you stored on the first visit. That match across cookie, incognito, and IP resets is exactly what a “remember this device” checkbox cannot do on its own.
Guardrails
Next
Run the same Score and DeviceID in the other direction with step-up authentication, which raises friction when a session is not clean, or guard a sensitive return against a hijacked session with account takeover. When the same device starts logging in across more accounts than a person should hold, account sharing and multi-accounting cover the inverse of trust. For the building blocks underneath this tutorial, the Identification reference explains how the DeviceID and VisitorID differ and which one survives what, Risk Scoring covers the score and bands, and the webhook payload and History API are the two ways to read thedevice_id and score for a visit.