xeno-sdk-web
v1.1.0
Published
Xeno Web SDK for user analytics and device fingerprinting
Downloads
1,971
Readme
📦 Xeno SDK Web
A lightweight TypeScript SDK for Xeno from the browser (and Node): user identity, event capture, and on-site web messaging (modals, banners, fullscreen pop-ups).
Install
npm install xeno-sdk-webShips ES module, CommonJS, and IIFE builds with type declarations.
Quick usage
import XenoSDK from 'xeno-sdk-web';
// 1. Configure (apiKey starting with `dev@` targets the dev environment).
// Returns the SDK instance.
const sdk = XenoSDK.configure({ apiKey: 'YOUR_API_KEY' });
// 2. Identify the user (instance method)
await sdk.setUser({ phone: '+91...' /* or email / customerId */ });
// 3. Capture events (instance method)
sdk.captureEvent('added_to_cart', { sku: 'ABC', qty: 1 });
// 4. Activate on-site messaging — web pop-ups (static)
XenoSDK.showOnSite();
// optional: route CTA deeplinks yourself (static)
XenoSDK.listenDeeplink((url, ctx) => router.push(url));Via CDN / <script>: the IIFE build exposes window.XenoSDK.
On-site messaging
Renders campaigns fetched from Xeno as Shadow-DOM overlays. Triggers: page_load,
scroll_depth, exit_intent, custom_event. CTA actions include deeplink, open-url,
copy-code, push-primer, and FORM capture. Session-scoped dedup (one show per campaign per
browser session; survives reload + tab duplication).
Docs: docs/INAPP_WEB_CONTEXT.md,
docs/ONSITE_DESIGN.md,
campaign + HTML examples in docs/onsite-campaign-examples.md
and docs/onsite-popup-html.md.
🛠 Local development
Prerequisites: Node.js >= 20 (Vite 7), npm.
git clone https://github.com/xenolab007/xeno-sdk-web.git
cd xeno-sdk-web
npm install
npm run dev # dev server → http://localhost:5173 (test at /test/index.html)
npm run playground # React on-site QA harness → http://localhost:5174
npm run build # emit dist/ (run before publishing)No automated test suite — manual QA via the browser.
