> AI agents: this is one page from PostHog's docs. Full index of Markdown docs for LLMs: https://posthog.com/llms.txt # Android web analytics installation Canonical URL: https://posthog.com/docs/web-analytics/installation/android > **Cloud region:** This page uses US Cloud hosts. For an EU Cloud project, use `https://eu.i.posthog.com` instead of `https://us.i.posthog.com` (ingestion host). ## On this page - [Install with the wizard](#install-with-the-wizard) - [Install the dependency](#install-the-dependency) - [Configure PostHog](#configure-posthog) - [Track screen views](#track-screen-views) - [Next steps](#next-steps) ## Install with the wizard Run this command in your project directory to add PostHog to your Android project. The wizard detects your framework, installs the SDK, and sets up your first events. `npx @posthog/wizard` Or set it up manually by following the rest of this guide. 1. 1 ## Install the dependency Required Add the PostHog Android SDK to your `build.gradle` dependencies: build.gradle ```kotlin dependencies { implementation("com.posthog:posthog-android:3.+") } ``` 2. 2 ## Configure PostHog Required Initialize PostHog in your Application class: SampleApp.kt ```kotlin class SampleApp : Application() { companion object { const val POSTHOG_PROJECT_TOKEN = "" const val POSTHOG_HOST = "https://us.i.posthog.com" } override fun onCreate() { super.onCreate() // Create a PostHog Config with the given project token and host val config = PostHogAndroidConfig( apiKey = POSTHOG_PROJECT_TOKEN, host = POSTHOG_HOST ) // Setup PostHog with the given Context and Config PostHogAndroid.setup(this, config) } } ``` 3. 3 ## Track screen views Recommended Despite the name, the web analytics dashboard can be used to track screen views in mobile apps, too. Open your app and view some screens to generate some events. To automatically track screen views, configure PostHog to capture screen views: SampleApp.kt ```kotlin val config = PostHogAndroidConfig( apiKey = POSTHOG_PROJECT_TOKEN, host = POSTHOG_HOST ).apply { captureScreenViews = true } PostHogAndroid.setup(this, config) ``` 4. 4 ## Next steps Recommended After installing PostHog and ensuring [autocapture](https://posthog.com/docs/product-analytics/autocapture.md) is enabled, head to your [web analytics dashboard](https://posthog.com/docs/web-analytics/dashboard.md) to see your data. And then check out our [start here](https://posthog.com/docs/web-analytics/start-here.md) guide. > **PostHog tip:** Web analytics works with [anonymous events](https://posthog.com/docs/data/anonymous-vs-identified-events.md). This means if you are primarily using PostHog for web analytics, it can be significantly cheaper for you.