Verify the SDK Is Firing
Confirm elNudge is installed correctly and events are reaching the platform before you go live.
Run through this checklist after installing to make sure the SDK is loaded and events are flowing. Catching issues here takes five minutes and saves debugging production problems later.
1. Check the global in your browser console
Open DevTools on your site (F12 or Cmd+Option+I) and paste this into the Console tab:
typeof window.__eln === 'function'
If the SDK is loaded, this returns "function". If it returns "undefined", the script has not loaded yet — see the common problems section below.
2. Enable debug mode and watch the console
Add data-debug="true" to your script tag:
<script
src="https://cdn.elnudge.com/v1/sdk.js"
data-site-key="sk_live_YOUR_SITE_KEY"
data-debug="true"
async
></script>
Reload the page. You should see structured log lines like:
[elNudge] SDK ready — session ses_01HXXXXX
[elNudge] event PAGE_VIEW { url: "https://yourstore.com/products/headphones", ... }
[elNudge] event SCROLL_DEPTH { depth: 25, url: "..." }
[elNudge] event SCROLL_DEPTH { depth: 50, url: "..." }
[elNudge] event EXIT_INTENT { ... }
If you fire a manual event while debug mode is on, it will appear immediately:
window.__eln('track', 'CART_ADD', { product_id: 'test', product_name: 'Test Product', price: 100, currency: 'INR', quantity: 1 })
// [elNudge] event CART_ADD { product_id: "test", ... }
Remove data-debug="true" before going to production — debug logs are verbose and will appear in your customers' consoles.
3. Use Live Preview in the dashboard
Live Preview gives you a real-time view of events and AI decisions without touching DevTools.
- Open app.elnudge.com and navigate to your site.
- Click Live Preview.
- In a separate tab, open your site and browse around.
- Events appear in the Live Preview panel as they are received by the platform — usually within one second.
Live Preview also shows which events triggered a nudge decision, and what the AI decided to do or say.
Common problems and fixes
window.__eln is undefined
Cause: The script has not loaded, or it loaded with an error.
Fixes:
- Open the Network tab in DevTools and filter for
sdk.js. Check that the request returns200 OK. A403or404means the CDN URL is wrong or the script tagsrchas a typo. - Make sure the
<script>tag is inside<head>or appears before the code that callswindow.__eln. - Check that your Content Security Policy allows
cdn.elnudge.com. Add it toscript-srcif needed:Content-Security-Policy: script-src 'self' https://cdn.elnudge.com;
An ad blocker is blocking the CDN
Browser ad blockers and privacy extensions sometimes block third-party scripts on CDN domains.
Fix: This only affects visitors who have ad blockers installed — not your own testing unless you have one active. Disable your ad blocker for your own site to test, then consider the first-party proxy install if block rates are high.
Events appear in debug console but not in Live Preview
Cause: The site key is correct but the WebSocket connection to wss://relay.elnudge.com is being blocked.
Fixes:
- Open the Network tab and filter by
WS. You should see a WebSocket connection torelay.elnudge.com. If it shows as blocked or pending, check your firewall or CSPconnect-srcdirective:Content-Security-Policy: connect-src 'self' wss://relay.elnudge.com https://api.elnudge.com;
Wrong site key format
Site keys must match exactly:
- Live:
sk_live_followed by 8 alphanumeric characters - Test:
sk_test_followed by 8 alphanumeric characters
A common mistake is copying only part of the key, or adding extra spaces. Paste directly from the dashboard's Install tab — do not retype.
If the key is invalid, the SDK logs an error in the console:
[elNudge] ERROR: invalid site key — check your data-site-key attribute
Script placed in <body> instead of <head>
The script works in <body> but fires the first PAGE_VIEW later in the page lifecycle, which can cause it to be missed for very fast sessions. Move it to <head> with the async attribute.