Verification & Testing
Verification Scope
Run this checklist:
- before production go-live
- after changing integration code
- after updating
siteKey, domain, API URL, or mobile key
Currency rule: all verification payloads use SITE_CURRENCY placeholder; replace with your ISO-4217 uppercase site currency.
1) Runtime Identity Checks
CDN mode
console.log(window.Selwise);
console.log(window.Selwise?.siteKey);
console.log(window.Selwise?.apiUrl);
console.log(window.Selwise?.getVisitorId?.());
console.log(window.Selwise?.getSessionId?.());
npm mode
console.log(widget.siteKey);
console.log(widget.apiUrl);
console.log(widget.getSiteUserId());
console.log(widget.getVisitorId());
console.log(widget.getSessionId());
React Native mode
console.log(sdk.getVisitorId());
console.log(sdk.getSessionId());
console.log(sdk.getJourneyState());
Expected:
- runtime instance exists
- IDs are generated
- environment config matches expected target
2) Network Checks
Expected requests:
| Endpoint | Method | Purpose |
|---|---|---|
/public/sites/:siteKey/config | GET | runtime configuration |
/public/sites/:siteKey/events/batch | POST | event ingestion |
/public/sites/:siteKey/orders | POST | order ingestion |
Optional fallback config requests:
/public/sites/:siteKey/tracking-config/public/sites/:siteKey/campaigns/public/sites/:siteKey/widgets
React Native Header Check
For RN requests verify:
x-selwise-api-keyx-selwise-client-platformx-selwise-client-version
3) Event Probe (Track API)
CDN or npm:
runtime.track('product_view', {
entityType: 'product',
entityId: 'prod_verification_001',
metadata: {
productItemCode: 'prod_verification_001',
title: 'Verification Product',
},
});
React Native:
sdk.track('product_view', {
entityType: 'product',
entityId: 'prod_verification_001',
metadata: { productItemCode: 'prod_verification_001' },
});
await sdk.flush();
4) Data-Layer Probe
runtime.pushDataLayer({
event: 'add_to_cart',
basket: {
id: 'cart_verify_001',
currency: 'SITE_CURRENCY',
total: 99.9,
products: [{ sku: 'prod_verification_001', quantity: 1, price: 99.9 }],
},
});
console.log(runtime.getDataLayer());
RN note:
pushDataLayer()verifies local state behavior.- network ingestion still depends on
track()+flush().
5) Order Probe
await runtime.trackOrder({
orderId: 'ORDER-VERIFY-001',
total: 99.9,
currency: 'SITE_CURRENCY',
items: [{ productItemCode: 'prod_verification_001', quantity: 1, unitPrice: 99.9 }],
});
6) Consent Probe
console.log(runtime.getConsentState());
runtime.grantConsent({ analytics: true, marketing: true, preferences: true });
runtime.revokeConsent(['marketing']);
RN note:
- consent write endpoints require
mobile_writescope.
7) Event Family Probe Set
Validate at least one event from each family:
- Page:
page_view - Product:
product_view - Cart:
add_to_cart - Checkout:
checkout_begin - Purchase:
purchaseortrackOrder - Search:
search_query - User:
user_login - Custom:
custom_event
Canonical payloads:
8) React Native Offline/Retry Probe
- Disable network.
- Call
sdk.track(...)multiple times. - Call
await sdk.flush()(expect queued retries). - Re-enable network.
- Call
await sdk.flush()again. - Verify queued events are drained successfully.
9) Common Failures
- Runtime instance missing.
- CDN script issue, npm client lifecycle issue, or RN init failure.
- Events missing in backend.
- Invalid canonical payload, consent gating, or environment mismatch.
- Mobile auth failures.
- API key missing/revoked/invalid scope.
- Duplicate events.
- Multiple active runtime instances.
Go-Live Checklist
- Runtime identity checks pass for selected platform.
- Config endpoint returns expected payload.
- Event and order probes hit backend successfully.
- Consent state transitions are reflected in behavior.
- RN header/scope checks validated (if mobile integration exists).
- Single runtime instance pattern enforced.