Web SDK
The EagleSense Web SDK collects the signals that only exist in the browser — device intelligence, bot indicators, and behavioral context — and ties them to your scoring requests through a session identifier. It improves accuracy on guest checkouts, card testing, and account abuse.
The SDK is collection-only: it makes no scoring decisions and returns none. Decisions are delivered exclusively to your backend via the Transaction Scoring API.
Install
Section titled “Install”Add the snippet to every page (not just checkout — cross-page behavior is part of the signal):
<script async src="https://cdn.eaglesense.ai/v1/es.min.js" integrity="sha384-<published with each release>" crossorigin="anonymous"></script>Loads asynchronously, no dependencies. The SDK never throws and never blocks your UI: any internal failure degrades silently to “not collecting”. If your site enforces a Content-Security-Policy, allow script-src and connect-src for the EagleSense domain — nothing else is needed.
EagleSense.init({ publicKey, merchantId, consent }) // on every pageEagleSense.identify({ userId, email }) // on login / signupEagleSense.track(eventName, props) // flow events, see belowEagleSense.getSessionId() // → es_session_idEagleSense.setConsent(true|false)The publicKey is publishable — it can only submit collection events and grants no access to data or decisions.
Link sessions to scoring
Section titled “Link sessions to scoring”Pass EagleSense.getSessionId() to your backend with the checkout request and include it as es_session_id in your Transaction Scoring API call. This single field is what connects browser signals to the transaction being scored.
Collected automatically
Section titled “Collected automatically”Device characteristics, automation/bot indicators, page transitions, and payment-form interaction events (focus, paste/autofill, typing timings).
Flow events
Section titled “Flow events”Instrument the key steps of your purchase flow:
| Event | Where |
|---|---|
identify({userId, email}) |
login, signup |
track('checkout_started') |
checkout opens |
track('order_context', {amount, itemCount}) |
checkout |
track('product_viewed', {productId}) |
product page |
track('cart_updated', {itemCount}) |
cart changes |
Single-page apps: track page transitions explicitly if your router does not change the URL. Custom events are accepted but not required.
Already running Segment?
EagleSense can consume your existing e-commerce events (Product Viewed, Checkout Started, Order Completed…) as a Segment destination — no markup needed; the snippet is then only required for the automatic device signals. Ask us during onboarding.
Consent
Section titled “Consent”With consent: false, the SDK sends only a session identifier — no device signals, no behavior. Call EagleSense.setConsent(true) once the user accepts, and collection starts from that moment. Emails are hashed at ingestion; see Data Security.
Verify your installation
Section titled “Verify your installation”- Checkout works with the SDK blocked or the CDN unreachable (it must).
EagleSense.getSessionId()returns a value on the checkout page.- Your scoring requests include
es_session_id. - After a test login, an
identifyevent appears in the network log.

