> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wendung.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Web analytics setup

> Turn on pageview tracking, register your site, clean up paths, and read the site dashboard.

Web analytics answers traffic questions for a site: how many people came, from where, which pages they read, and how long they stayed. It runs on the same SDK install as your funnels. This guide takes you from a fresh project to a site dashboard with clean paths.

## Setup

<Steps>
  <Step title="Turn on pageview tracking">
    Automatic pageviews are off by default. Set `trackPageviews: 'auto'` to collect aggregate pageviews while consent is pending and full pageviews after consent. Pass the visitor's current consent choice on every load.

    ```ts theme={null}
    Wendung.init({
      apiKey: 'pk_your_publishable_key',
      trackPageviews: 'auto',
      consent: 'pending',
    })
    ```

    Call `Wendung.setConsent('granted')` or `Wendung.setConsent('denied')` from your consent manager. If you want to wait for consent before collecting anything, use `trackPageviews: true`. See the [consent guide](/guides/consent) for saving and restoring the choice.

    The SDK observes `pushState`, `replaceState`, and `popstate`. Aggregate collection ignores changes to only the query string or fragment.

    If your router changes the URL without touching the history API, call `page()` yourself after each navigation. It records a pageview for the current URL.

    <Note>
      Pageviews count against your plan's monthly pageview allowance, separate from events. The free plan has no allowance, so web analytics is available on paid plans only. See [Plans and limits](/help/plans#monthly-pageviews).
    </Note>
  </Step>

  <Step title="Register the site">
    Pageviews are stored per project, but the reports are per hostname. Open **Sites** in the sidebar and click **Add site**. The hostname picker lists your project's [allowed origins](/help/settings#allowed-origins); pick the one you want to report on.

    If you deploy the same app on several hostnames, register each one. The **All sites** row on the Sites page combines them.
  </Step>

  <Step title="Clean up paths">
    Open the site's settings to add path rules and a query parameter allowlist. Built-in rules already collapse numeric IDs and UUIDs to `:id` and `:uuid`; add your own for anything else that fragments a page, such as slugs or short codes.

    Paste a real URL into **Preview** to see the normalized result before you save. Rules affect pageviews collected from then on. See [Pageviews and sessions](/concepts/pageviews#path-normalization) for how matching works.
  </Step>

  <Step title="Read the site dashboard">
    Click the site to open it. The metric rail shows unique visitors, pageviews, sessions, views per session, bounce rate, and session duration; click any of them to chart it. The panels below rank pages, sources, locations, and devices. Click a row to filter the whole page by that value, and hover a row for copy and filter actions.

    Pageviews include aggregate and consented traffic. Visitors, sessions, engagement metrics, and the current-visitors badge cover consented traffic only. Aggregate pageviews do not create visitors or sessions. See [metric coverage](/concepts/pageviews#sessions).
  </Step>

  <Step title="Tag campaign links">
    To see where a campaign's traffic goes, add the standard parameters to the links you send out. The ingest endpoint reads them from full pageviews. Aggregate pageviews omit query parameters, so they cannot carry campaign tags.

    ```
    https://example.com/?utm_source=newsletter&utm_medium=email&utm_campaign=spring_launch
    ```

    The visits show up under **Sources → Campaigns**, split by campaign, UTM source, or UTM medium, and each value is a filter. See [campaign parameters](/concepts/pageviews#campaign-parameters) for what is captured.
  </Step>

  <Step title="Pin sites to the Overview">
    Open **Overview** and switch to the **Web** tab. It shows the **All sites** card and one card per pinned site, each with a 24-hour sparkline and a visitor count. Use the **+** card to pin more sites, and the card menu to unpin them. The Overview remembers which tab you looked at last.
  </Step>

  <Step title="Add web blocks to a dashboard">
    Dashboards have three web block types: **Web summary**, **Web trend**, and **Web breakdown**. Each block can be scoped to one site or to all sites, and each has its own period. Shared dashboards include them.
  </Step>
</Steps>

## Filtering

Every panel row is a filter. Clicking `/pricing` in **Top pages** filters the report to that path; clicking again removes the filter. The filter bar accepts **is** and **is not** for every dimension, so "Country is not United States" is one click away from the row action. Filters and the date range are part of the URL, so a filtered view can be shared as a link.

## What's next

<CardGroup cols={2}>
  <Card title="Pageviews and sessions" icon="eye" href="/concepts/pageviews">
    What each pageview carries and how sessions and normalized paths are derived.
  </Card>

  <Card title="Site details" icon="chart-line" href="/help/site-details">
    Every panel and control on the site dashboard.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.