Skip to content
Optima docs
SDKsAndroid SDK

Differences from the Web SDK

Android SDK v1.4.0 — Differences from the Web SDK

The Android SDK follows the Web SDK as closely as the platform allows — same event names, same wire contract, same consent semantics. Where they diverge, it's a deliberate consequence of not running inside a browser DOM, or of an iteration boundary for this first release. This table is the authoritative list; every row below is discussed in more depth in the chapter its right-hand column links to.

Web SDKAndroidWhy
page(), SPA history hooks (pushState/popState interception)screen(name) + automatic Activity tracking (ch. 3, ch. 2)There's no browser History API on Android. screenTracking = AUTO substitutes ActivityLifecycleCallbacks (one screen() per Activity resume, named after the Activity's simple class name) for SPA route-change detection; screenTracking = OFF is the manual escape hatch for apps whose navigation model (Compose Navigation, single-Activity, Fragments) doesn't line up with Activity boundaries.
Tracker script activation (data-optima-tracker DOM attribute), managed script/html/page tagsOnly the gate (consent.can, consent.changes) and the pixel kind (ch. 4, ch. 3)A managed script/html tag means "inject and run this JavaScript/markup on the page" — a concept with no equivalent on a native screen. A pixel (a plain GET request) has no such dependency and fires natively; script/html/page-kind rows are recognized but intentionally inert, logged once at debug ("managed script/html tags are not runnable on Android; ignored").
web_personalization itemsDropped with one debug line (ch. 5)Server-side template personalization rewrites DOM content that simply doesn't exist as a concept on a native screen.
Cookies, cookieDomain configSharedPreferences onlyAndroid apps don't share a cookie jar with anything; there's no cross-subdomain identity problem for a cookieDomain setting to solve, and nothing analogous to configure.
Global Privacy Control (navigator.globalPrivacyControl)None on AndroidGPC is a browser-signal standard with no OS-level Android equivalent to read.
Google Consent Mode dataLayer reader (automatic gtag/dataLayer observation)Manual setGCM only; TCF is read automatically from IABTCF_* prefs (ch. 4)Google Consent Mode is a dataLayer/gtag.js convention specific to web pages; there's no equivalent runtime object to observe on Android. TCF, by contrast, has a real cross-platform convention (IABTCF_TCString in default SharedPreferences on Android, localStorage on web) that every compliant CMP SDK already writes to, so the SDK reads it the same way on both platforms.
codeMode inline/sandbox, CSP nonces, content:blocked eventhtmlMode WEBVIEW/OFF; HTML runs in an isolated WebView (ch. 2, ch. 5)A browser page executing operator-authored script inline is a same-origin risk that CSP/sandboxing/nonces exist to contain. A native app has no "page origin" for that script to inherit in the first place — isolating it into its own WebView (no shared cookies/storage with the host app) achieves the same containment goal with a platform-native mechanism instead of a web-specific one, so there's no content:blocked event to fire — the isolation is structural, not something a customer's CSP can block.
forms.render (a full native-DOM form renderer)Not in this iteration — forms.load (headless) + the hosted page in a Custom Tab (ch. 6)Rendering an arbitrary field-driven form natively, matching a design system you don't control, is a materially larger surface than the rest of this SDK's UI (which mirrors a small, fixed set of content-item shapes). Headless loading plus a Custom Tab link to the same hosted page the Web SDK's own non-JS fallback uses covers every form today without committing to a native form-widget API prematurely; a native renderer is a plausible follow-up once real usage informs what it should look like.
—push.* (setToken, parse, trackOpen)Mobile push has no web equivalent in this SDK's scope — it exists purely because mobile apps need it, not because it mirrors something the Web SDK does differently. See chapter 7.

What's identical

Everything not in the table above is the same on purpose: track/identify/ reset/deviceId/flush/the event names and payloads, the consent omit-vs-[] declaration rule, the outbox batching numbers (20 hits / 2s coalesce), the retry backoff ladder (1s/2s/5s/15s/60s), the display rule schema (trigger/frequency/dismissible/ttl_days/placement), campaign mobile_inapp impression/click/dismiss feedback, the tracker-gate consent.can pattern, and the wire contract itself (docs/oapi3_edge.yml/contract/oapi3_edge.yml) — a change on one side of that contract is a change on both. If you've integrated the Web SDK before, almost everything here should feel immediately familiar; this table is deliberately the complete list of what doesn't.

On this page