Scan your whole stack
Are you using @selwise/react-native?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v2.0.2
@selwise/react-native was last scanned on 27 Nov 2026 at version 2.0.2. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 2.0.2 LATEST | 27 Nov 2026 | No rules fired |
| 2.0.1 | 19 Nov 2026 | No rules fired |
| 2.0.0 | 18 Nov 2026 | No rules fired |
| 1.6.0 | 17 Nov 2026 | Not shown |
| 1.5.0 | 14 Nov 2026 | Not shown |
Findings for v2.0.2. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 2.0.2; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
The Selwise SDK for React Native apps: event tracking, recommendations, search and order attribution — without a DOM — and the components that draw what the dashboard configures: campaigns, recommendation strips, search results and product content.
Why a separate package.
@selwise/widgetis DOM-bound from top to bottom (document,window,localStorage). Native apps render their own screens — product detail, product list, search, basket — and a browser widget cannot run there. This package has two layers. The core (@selwise/react-native,@selwise/react-native/react) delivers data and needs no UI library. The components (@selwise/react-native/ui) draw it with React Native and are the quickest way to see everything the dashboard configures in your app; every one of them takes your own component where you want your own look.
npm install @selwise/react-native
No required dependencies. react is needed only for the hooks under
@selwise/react-native/react, and react-native only for the components under
@selwise/react-native/ui; both are optional peers, so the core SDK stays
importable from services, sagas and redux middleware.
The components do not depend on react-native-webview or
react-native-safe-area-context either: an app that has them hands them over
(see Drawing it: the components).
For persistence, pass the app's existing AsyncStorage — the SDK ships no native dependency of its own:
npm install @react-native-async-storage/async-storage
An app is an app channel in Selwise — a channel with no domain to verify
and therefore nothing an Origin header could ever be evidence for. The
server's PublicSiteGuard authenticates every app-channel request by API key
and scope, unconditionally. (A native fetch sends no Origin header anyway;
for an app channel the key is required even when one is present, so an in-app
WebView takes the same path as the native code beside it.) Which means:
The key must carry BOTH mobile_read AND mobile_write.
The reason is subtle but absolute: the recommendation products endpoint is a
POST (POST /recommendations/:widgetId/products — it carries visitor
context in the body), and the guard derives the required scope from the HTTP
method (GET → mobile_read, everything else → mobile_write). A read-only key
returns 403 there and nowhere else, which is the single most common mistake
in a mobile setup.
Create the key in the dashboard under Channels → the channel's card → API keys, choosing Mobile app as the purpose.
The key ships inside the app binary and can be extracted. That is acceptable: its scopes cover public reads plus event and order writes only, with no dashboard access. Rotate it from the dashboard if it leaks.
// src/services/selwise.ts
import AsyncStorage from '@react-native-async-storage/async-storage';
import { Selwise } from '@selwise/react-native';
export const selwise = new Selwise();
export async function initSelwise() {
await selwise.init({
channelKey: 'CHANNEL_KEY',
apiKey: 'SELWISE_API_KEY',
storage: AsyncStorage,
debug: __DEV__,
});
}
init() resolves identity and replays the queue left over from the previous
session. It does not wait on a network round-trip, so it never blocks the
first screen.
Flush the queue to disk as the app leaves the foreground:
import { AppState } from 'react-native';
AppState.addEventListener('change', (state) => selwise.setAppState(state));
setAppState does two things: on any state but 'active' it flushes the queue
and writes the visitor's session counters (the app may not get another chance),
and it drives the live heartbeat. The
dashboard's Live View counts an app user as live while the app is in the
foreground: the SDK posts /presence once a minute (the server sets the
interval) while the state is 'active', only with analytics consent, and only
for a user whose events the server accepted in the last 30 minutes — a
heartbeat never makes anyone live on its own. A beat is skipped when an event
batch was accepted within the interval, and after a live: false answer the
SDK stays silent until the next accepted batch. Without setAppState the SDK
assumes the foreground and stops beating after 30 minutes with no SDK call.
| Option | Type | Default | Notes |
|---|---|---|---|
channelKey |
string |
— | Required (or siteKey). From Channels → the channel's card. |
siteKey |
string |
— | The published name for the same value. Kept forever; pass either one. |
apiKey |
string |
— | Required. Needs mobile_read + mobile_write (see above). |
apiUrl |
string |
https://api.selwise.com/api/v1 |
Point at staging when needed. |
storage |
SelwiseStorage |
in-memory | Pass AsyncStorage. See Running without storage. |
consent |
ConsentSnapshot |
managed by the app (app_managed) |
See Consent. |
siteUserId |
string |
— | Logged-in user id, if known at init. |
batchSize |
number |
20 |
Events per flush. Server caps at 200. |
flushIntervalMs |
number |
5000 |
0 disables the timer — flush manually. |
timeoutMs |
number |
10000 |
Per-request timeout. |
maxQueueSize |
number |
500 |
Offline cap; oldest events are dropped first. |
debug |
boolean |
false |
Diagnostics via console.log, and the on-device diagnostics button. Development builds only. |
clientPlatform |
string |
react-native |
Sent as x-selwise-client-platform. |
clientVersion |
string |
SDK version | Sent as x-selwise-client-version. |
locale |
string |
— | The app's language ('en', 'tr-TR'). See Languages. |
platform |
'ios' \| 'android' |
— | Platform.OS. Lets a segment target the OS the app runs on. |
appVersion |
string |
— | The app's own release ('3.4.1'). A segment can compare it (appVersion < 3.5). |
Any storage implementing getItem / setItem / removeItem works —
AsyncStorage satisfies the contract as-is, and MMKV needs a three-line adapter.
Every event needs a consent category — analytics for what the visitor did
(views, cart, search, purchase, identity), marketing for what a Selwise surface
did to them (impressions, clicks, experiment exposures). The list is shared with
the web widget and the API (consentCategoryOfEvent); an event it does not name
needs analytics. POST /events/batch requires a consent snapshot and drops
every event whose category the snapshot does not allow.
If the app never calls setConsent(), the SDK reports that the app manages
consent (source: 'app_managed', every category allowed) and sends everything.
Every event records that source: you are then responsible for asking before
you track.
The channel can require a decision. When the channel's Cookie Consent
policy waits for an answer (Dashboard → Audience → Cookie Consent → Policy:
"Takipten önce onay iste" and "Cevaba kadar olayları beklet" on, "Cevap
gelmezse onay verilmiş say" off), the app_managed default no longer stands
in for a decision: until setConsent() is called, getConsent() answers
{ granted: false, source: 'awaiting_decision' } and nothing that measures the
visitor is sent. Events are held, not discarded. The SDK reads the policy from
/config before its first send and remembers it, so a launch on which
/config fails still honours it.
To send nothing until your CMP has decided:
await selwise.init({ /* ... */, consent: { granted: false } });
// once the CMP resolves:
await selwise.setConsent({ granted: true, categories: { analytics: true, marketing: false } });
Consent is evaluated at send time, not at track time. Events recorded while the visitor has not answered are held and sent once they answer — only those whose category the answer allows. An event of a refused category is dropped; a later grant is consent from then on and does not bring it back.
The answer also decides what is read about the visitor:
| Without | What happens |
|---|---|
analytics |
identify() keeps the id on the device and sends it once allowed; an order is recorded without the visitor, unattributed. |
marketing |
The visitor is in no experiment (the control is shown), segment reads answer "in no segment", recommendation requests carry no visitor id, the scenario inbox is not read. |
A surface or an experiment can be restricted to consenting visitors with the
consentAnalytics / consentMarketing / consentPreferences targeting rules;
the SDK fills them from the consent answer.
pageUrlA native app has no URLs, but page targeting, funnels and journeys are all URL-shaped server-side. Use one stable synthetic value per screen and target those in the dashboard:
selwise.trackScreenView('app://home');
selwise.trackScreenView('app://category');
selwise.trackScreenView('app://product');
selwise.trackScreenView('app://basket');
trackScreenView() sets the current screen context and sends a page_view.
Use setScreen() when you want the context without the event — subsequent
events are attributed to that screen either way. Both take what you know about
the screen as a last argument — { screenName, pageType }, the dashboard's page
type (home, product, category, search, cart, checkout, account,
other) — and the components follow it: selwise.getScreen() reads it back and
selwise.on('screen', listener) tells you when it changes (see
State and subscriptions). They may be called before
init() resolves.
Recommendation widgets must have their page targeting configured against these
values: app://product instead of the web's /product/*.
track() never throws and never awaits the network, so it is safe to call
from a render path or a gesture handler.
selwise.trackProductView('SKU-12345');
selwise.trackAddToCart('SKU-12345', { quantity: 1, price: 749.9, currency: 'TRY' });
selwise.trackRemoveFromCart('SKU-12345');
selwise.track('checkout_begin', {
entityType: 'checkout',
metadata: { total: 1499.7, currency: 'TRY', itemCount: 3 },
});
itemCode=item_codein the product feed. When they disagree, product-level reports drop the product. It is usually the variantsku, but some catalogues use a composite such asbase_code.coloras the GA4item_id. Settle the convention once, together with the feed; mixing the two breaks analytics silently.
await selwise.identify('merchant-user-id', { // sign-in
email: 'customer@example.com',
memberTier: 'gold',
});
await selwise.logout(); // sign-out: visitor kept, session rotated
identify() does two things: it stores the id locally, so every later event
and order carries it, and it tells the server, which merges the anonymous
history collected before the sign-in into that customer. Without the second
part no site_users row exists, so the person never appears in a segment, on a
customer profile or in CLV — even though their events carry the id.
Traits are yours to choose. email is lifted out because the server has a
column for it; everything else is stored as traits and is available to segment
rules.
phone is lifted out too and is not sent: a phone number as a trait would
sit in clear text where every segment and export can read it, and sign-in has no
field for one. A number reaches Selwise as a consent decision — the order's
marketingConsent below, or the newsletter form.
The SDK adds what it knows about the app to the traits — platform, appVersion,
appLocale and pushPermission — so a segment of signed-in customers can be
built on them. Tell it the notification permission whenever you learn it:
selwise.setPushPermission('granted'); // 'granted' | 'denied' | 'undetermined'
It also lets a segment say "has not allowed notifications", and it is the permission app push is judged on. The same facts, and which screens this device opened in the last days, go with every segment request.
It never throws: it is called from a sign-in handler, and the local id is already set by the time the network call runs.
The customer id is otherwise taken on the app's word. To prove it came from you, have your backend sign it with the channel's identity secret (Dashboard → Channels → the channel → Signed identity) and return the signature with the sign-in response. The secret never goes into the app.
// your backend (Node), at sign-in
const userHashTs = Math.floor(Date.now() / 1000);
const userHash = crypto
.createHmac('sha256', process.env.SELWISE_IDENTITY_SECRET)
.update(`${customerId}:${userHashTs}`)
.digest('hex');
// the app
await selwise.identify(customerId, { email }, { userHash, userHashTs });
A timestamped signature is valid for 7 days; HMAC(secret, customerId)
without userHashTs is accepted too. Once the dashboard shows every identify
as signed, the channel can enforce signed identity: an unsigned identify
then still records events but can no longer read the customer's segments or
recommendations, or tie a contact to them.
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.