Pick a guide
Get the SDK
Each SDK is one source file that you download and add to the app. There is no package to install from npm, CocoaPods, Maven or pub.dev, and the file has no dependencies of its own.
To update, download the file again and replace the old one. The SDK version is the
sdk_version property on every event.
Use the same public key as the website, the cs_pk_… value from Settings, Tracking code. One site then shows the website and the app together.
An app with no website
A site does not need a domain. When you add one, choose Mobile app and enter the app’s bundle id (iOS) or application id (Android), such ascom.acme.app, where a website enters its domain.
- The install step then shows the four SDKs, with your id already in the snippet.
- One app site takes both platforms. The iOS and Android apps send to the same public key.
- An application id may contain an underscore, such as
com.acme.my_notes. It is stored in lower case. - If the app gets a website later, add its domain under Settings, General, Additional hostnames. The script tag and its options then appear in Tracking code.
What you see in the dashboard
Filter the browser breakdown to iOS app or Android app when you want the app without the website. The website’s hostname allowlist does not apply to the bundle id. An excluded path does: a pattern that matches the screen path drops that screen.
Campaigns and referrers
An app has no address bar, so the SDK cannot see where a user came from. When a deep link or a push notification opens the app, pass its campaign tags with the screen it opens. Every SDK has a helper that reads them from the link, and each guide shows the call. The tags are read the same way as on a web page:utm_source and utm_medium set the channel, and utm_campaign, utm_term, utm_content, ref and ad click ids such as gclid are kept. A referrer URL you pass is classified with them. Both apply to that one screen view and start a new session when the campaign differs from the last one.
Visitors and sessions
The install id does not change when the phone moves from Wi-Fi to cellular, and it does not rotate at midnight. The collector stores a hash of it, a different hash on every site, so the id cannot be matched across sites. A session still ends after 30 minutes away, or when a later screen arrives with a different campaign. When the app returns to the foreground after 30 minutes or more, the SDK counts the current screen again, so the new session starts with a screen view. The overview’s visitor total still adds one for each day an install is seen, across the range you pick, unless persistent visitors is on for the site. Turning that on also stores an id in the browser on the website. Events sent while the device is offline wait on the device, up to the newest 100, and are stored when they arrive. The SDK tries again when the app starts, when it returns to the foreground and after each new event. The dashboard uses the time the collector received them.What an event looks like
A screen view is a normal collect request, with anm block that only an app sends:
vid is the install id, 32 hex characters. sn is the screen name. os is ios or android. d is phone or tablet. Campaign tags travel in the query string of u, such as app://com.acme.app/Pricing?utm_source=newsletter, and a referrer in r. Revenue uses a in minor units and c as a three-letter currency, the same as the website. A negative amount is ignored: refunds come from the payment provider.
The website script never sends m. An HTTP client that posts an ordinary pageview, with no app block, is still dropped as a bot.
Privacy
The SDK does not read the Identifier for Advertisers, the Android advertising id, or the device serial. It does not fingerprint the device. Opt out with the SDK’soptOut call: queued events are dropped and nothing further is sent until optIn.
Revenue from the App Store and Google Play can still arrive through RevenueCat, Superwall or App Store Connect. Those connections are separate from the SDK. Pass the same user id to identify and to the store if you want a purchase linked to the install.
Next steps
iOS
Add the Swift file and count the first screen.
Android
Add the Kotlin file. No extra library.
React Native
Count screens from JavaScript.
Flutter
Count screens from Dart.