Skip to content

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.

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 page
EagleSense.identify({ userId, email }) // on login / signup
EagleSense.track(eventName, props) // flow events, see below
EagleSense.getSessionId() // → es_session_id
EagleSense.setConsent(true|false)

The publicKey is publishable — it can only submit collection events and grants no access to data or decisions.

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.

Device characteristics, automation/bot indicators, page transitions, and payment-form interaction events (focus, paste/autofill, typing timings).

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.

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.

  • 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 identify event appears in the network log.