Web layer (Web SDK)
After you complete Getting started with the TWA SDK, the web portion of your TWA app uses the Adtrace Web SDK for install (on first open), sessions, events, callbacks, and attribution.
There is no separate TWA event or callback API. The only TWA-specific step is passing device IDs from the native launch URL into initSdk (see Initialize the Web SDK). After that, follow the Web SDK documentation.
What is different in TWA vs a browser PWA?
| Topic | Browser PWA | TWA |
|---|---|---|
| Device IDs | Read by Web SDK in the browser | Passed from native Android via launch URL query parameters |
| Install test ID | web_uuid in Testing Console | gps_adid in Testing Console |
| Test device | Browser on mobile recommended | Physical mobile phone or Google Play emulator required |
| Native Android SDK init | Not used for attribution | Used only to read gps_adid before launch |
Everything else ( trackEvent, attributionCallback, partner parameters, revenue, deduplication, and so on) is identical to the Web SDK.
Before events and callbacks
Before you send events or rely on attribution callbacks, verify install was recorded for the device. If no install is recorded, Adtrace may store events but they will not appear in panel statistics.
- Finish TWA integration including Web SDK
initSdk. - Test on a physical mobile phone or Google Play emulator.
- Confirm install in the Testing Console using
gps_adid.
If gps_adid is missing on the web side, see FAQ.
Web SDK guides
Use these docs for implementation details. API names, parameters, and examples are the same in TWA.
Quick reference
// Same as Web SDK after TWA initSdk (with gps_adid from launch URL)
Adtrace.trackEvent({
eventToken: 'YOUR_EVENT_TOKEN',
});
Adtrace.initSdk({
appToken: 'YOUR_APP_TOKEN',
environment: 'sandbox',
gps_adid: gpsAdidFromLaunchUrl,
attributionCallback: function (e, attribution) {
// Same Web SDK callback
},
});