Docs Getting started Environments & test keys

Test Keys and Environments

Use test site keys on staging and development to fire events without triggering nudges for real visitors.

elNudge uses separate site keys for production and non-production environments. This lets you integrate and test on staging or localhost without affecting real visitors or polluting live data.

Key formats

PrefixEnvironmentNudges fire?Events logged?
sk_live_XXXXXXXXProductionYesYes
sk_test_XXXXXXXXTest / SandboxNoYes

What is different in test mode

When you use a sk_test_ key:

  • No nudges are delivered to real visitors. The AI still evaluates intent signals, but the widget does not appear in production browsers.
  • Events are logged normally. You can verify that CART_ADD, PURCHASE, and other events are being fired correctly in the dashboard.
  • Debug mode is enabled automatically. Every event is printed to the browser console even without data-debug="true", so you can see exactly what the SDK is sending.
  • Nudges appear with a "TEST" badge. If you open the site in a browser where you are logged in to the elNudge dashboard, nudge widgets will render with a yellow "TEST" label so you can preview the experience without it being shown to customers.

Getting a test key

  1. Log in to app.elnudge.com.
  2. Open your site, then navigate to Settings → API Keys.
  3. Click Create key and choose Test from the key type dropdown.
  4. Copy the generated sk_test_XXXXXXXX key.

Each site can have multiple test keys. Rotate them from the same screen.

Recommended environment setup

Use your test key in all non-production environments and your live key only in production. A common pattern using an environment variable:

HTML template / server-side render:

<script
  src="https://cdn.elnudge.com/v1/sdk.js"
  data-site-key="{{ ELNUDGE_SITE_KEY }}"
  async
></script>

Next.js (.env.local / .env.production):

# .env.local (development + staging)
NEXT_PUBLIC_ELNUDGE_SITE_KEY=sk_test_XXXXXXXX

# .env.production
NEXT_PUBLIC_ELNUDGE_SITE_KEY=sk_live_XXXXXXXX
<script
  src="https://cdn.elnudge.com/v1/sdk.js"
  data-site-key={process.env.NEXT_PUBLIC_ELNUDGE_SITE_KEY}
  async
/>

Shopify (separate stores):

If you maintain a Shopify development store alongside your live store, install the elNudge app on both stores. Each store gets its own site in the dashboard with its own keys — the development store uses the test key automatically when you install via the App Store on that store.

Switching between environments

Switching a site between test and live mode is as simple as swapping the data-site-key attribute value. There is no other configuration to change — all dashboard settings (persona, quiet zones, widget position) apply in both modes.

Test mode and automated CI

If you run end-to-end tests that navigate real browser sessions, use a test key and set data-debug="true" so your test runner can assert on console output. You can also silence the widget entirely for automated tests by calling:

window.__eln('config', { quiet: true })

This prevents the widget from appearing during test runs without needing to mock the SDK or remove the script tag.