Observed since 20 Oct, 18:05 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
11metrics-pixel-react-native
Official 11metrics tracking SDK for React Native apps. Zero native dependencies — pure-JS SHA-256 hashing, a pluggable storage adapter for persistent anonymous IDs, and an optional React Navigation integration for automatic screen-view tracking.
Official 11metrics tracking SDK for React Native apps. Talks to the same
POST /api/pixel endpoint the web pixel.js SDK uses — no backend changes
required to start receiving mobile events.
Zero native dependencies: hashing is pure-JS SHA-256 (no crypto.subtle,
no native crypto module to link), and identity persistence is a pluggable
storage adapter rather than a hard dependency on any specific storage
library. Works in Expo Go and bare React Native alike.
npm install 11metrics-pixel-react-native
// App.tsx
import AsyncStorage from '@react-native-async-storage/async-storage'; // recommended, not required
import { init, screenView, track, identify } from '11metrics-pixel-react-native';
init({
pixelId: 'YOUR_PIXEL_ID', // Settings → Pixel Setup in the 11metrics app
pixelUrl: 'https://app.11metrics.ai', // optional, this is the default
storage: AsyncStorage, // optional — omit to fall back to in-memory (resets each app restart)
});
// Manual screen tracking.
screenView('ProductDetail', { product_id: 'abc123' });
// Custom event.
track('button_press', { button: 'checkout' });
// After login. email/phone are hashed on-device before anything is sent.
identify({ email: 'user@example.com', first_name: 'Marco' });
import { NavigationContainer } from '@react-navigation/native';
import { trackNavigationStateChange } from '11metrics-pixel-react-native';
export default function App() {
return (
<NavigationContainer onStateChange={trackNavigationStateChange}>
{/* ... */}
</NavigationContainer>
);
}
Not using React Navigation? Call screenView(name) yourself wherever your
navigation library exposes a focus/route-change event.
crypto.subtle isn't reliably available across React
Native's JS engines (Hermes/JSC) and versions. Rather than require a
native crypto module (native linking, pod install, Expo config plugins —
friction most SDKs don't need to impose), this package ships its own
pure-JS SHA-256 implementation, verified against known FIPS test vectors
(see smoke-test.mjs).localStorage equivalent built into
React Native's JS runtime — every persistence option (AsyncStorage, MMKV,
SecureStore) is a native module. Rather than pick one and force it on
every consumer, init({ storage }) accepts anything with a
getItem/setItem shape. @react-native-async-storage/async-storage
is the recommended default (it's already in most React Native apps), but
MMKV or your own adapter both work identically.trackNavigationStateChange accepts state: unknown rather than importing @react-navigation/native's types, so
this package has zero dependency on it — apps using a different
navigation library (or none) simply don't call that function.init(config: { pixelId, pixelUrl?, storage?, gpc?, priorBlocking?, consent? })screenView(screenName, meta?) — sent as event: "pageview", same event
type web uses, so mobile screen views land in the same reports as web
pageviews with no extra setup.track(name, meta?) — custom event.identify(data) — { email?, phone?, first_name?, last_name? }.setConsent(granted: boolean) — record the visitor's consent decision from
your app's consent screen (flushes buffered events + starts persisting the
device id when granted; stops sending + drops the buffer when withdrawn).getAnonymousId() — the persisted per-device anonymous id.trackNavigationStateChange(state) — wire into React Navigation's
onStateChange for automatic screen tracking.RN has no cookies or navigator.globalPrivacyControl, so the equivalents are
config + storage:
init({ gpc: true }) when your app should honour a universal
opt-out (e.g. an OS/app "opt out of tracking" toggle). Analytics are
suppressed, the device id is never persisted, and one gpc_optout beacon is
sent so the server records the withdrawal in the consent ledger.init({ priorBlocking: 'geo' | 'strict' }). Events are
buffered until a consent decision resolves, then replayed exactly once
(the web q() defer/replay). geo asks /api/pixel/consent-context and
holds only for visitors who require prior consent; strict always holds
until setConsent(true). The persistent device id is written to storage
only once analytics is allowed.priorBlocking: 'off', no gpc) — unchanged: events send
immediately. Drive consent yourself with setConsent() /
init({ consent: boolean }).npm install
npm run build
npm test # runs the build, then sha256 + payload smoke tests
npm run build
npm test
npm login # once, with your npm account
npm publish # from this directory
Bump version in package.json first if this isn't the first release.
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
typescriptEnvironment{
"local_name": "typescript",
"alias": false,
"peer_metadata": null
} | ^5.6.0 | development |
@types/nodeEnvironment{
"local_name": "@types/node",
"alias": false,
"peer_metadata": null
} | ^22.0.0 | development |
reactEnvironment{
"local_name": "react",
"alias": false,
"peer_metadata": null
} | >=17.0.0 | peer |
react-nativeEnvironment{
"local_name": "react-native",
"alias": false,
"peer_metadata": null
} | >=0.65.0 | peer |
Source distribution
{
"shasum": "e65bd7340432dff7a44ab992f02919d2b796a87f",
"tarball": "https://registry.npmjs.org/11metrics-pixel-react-native/-/11metrics-pixel-react-native-0.1.0.tgz",
"fileCount": 15,
"integrity": "sha512-2Pu9SfJDpxxi0SzxoTAKHBKVu2e94NpVpc8YgbbaC2VIhH67zvhtrN24lpyCGwdBwhxSWzabjRHh+tIGNo1CDw==",
"signatures": [
{
"sig": "MEQCIEamAA30xvorFP43uah0bipk2GhccoIlYcsXUrA5KErUAiBUC+pX14zTS5x0QNozuxpHFe2U2Q0uBmfIXIxsEMOMJw==",
"keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
}
],
"unpackedSize": 33593
}Observed since 20 Oct, 18:05 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:2218fab548610d4db3bd3cd7f8043f287c58627c673d92975b692a53c44beef8