|
| 1 | +--- |
| 2 | +title: Getting started |
| 3 | +description: Install Web Analytics, configure a provider credential, and verify the first connection. |
| 4 | +--- |
| 5 | + |
| 6 | +This guide covers the shared path for both providers. Provider-specific identifiers and capabilities are covered in the [Vercel](/providers/vercel) and [Plausible](/providers/plausible) guides. |
| 7 | + |
| 8 | +## 1. Install the package |
| 9 | + |
| 10 | +Add Web Analytics to the Umbraco web project: |
| 11 | + |
| 12 | +```sh |
| 13 | +dotnet add package TheBuilder.WebAnalytics |
| 14 | +``` |
| 15 | + |
| 16 | +The package registers its services and backoffice extensions automatically. Build and deploy the Umbraco application as usual; NuGet static web assets include the package's `App_Plugins` files. |
| 17 | + |
| 18 | +## 2. Choose a provider and configure its secret |
| 19 | + |
| 20 | +Create a read-only credential that can access the provider account you will connect. Add it to the application's secret configuration—not `appsettings.json` and never source control. |
| 21 | + |
| 22 | +<Tabs inline param="provider"> |
| 23 | + <Tab title="Vercel"> |
| 24 | + Create a Vercel access token with read access to the project. Configure it as `WebAnalytics__Providers__Vercel__AccessToken`, then use the project's ID as the connection identifier in Umbraco. Add the team ID only when the project belongs to a Vercel team. |
| 25 | + |
| 26 | + For local development, use either a shell environment variable or .NET user secrets: |
| 27 | + |
| 28 | + ```sh |
| 29 | + dotnet user-secrets init --project path/to/Your.Umbraco.Web.csproj |
| 30 | + dotnet user-secrets set "WebAnalytics:Providers:Vercel:AccessToken" "your_token" --project path/to/Your.Umbraco.Web.csproj |
| 31 | + ``` |
| 32 | + </Tab> |
| 33 | + <Tab title="Plausible"> |
| 34 | + Create a Plausible Stats API key with access to the site. Configure it as `WebAnalytics__Providers__Plausible__AccessToken`, then use the site's exact domain as the connection identifier in Umbraco. For a self-hosted instance, also configure `WebAnalytics__Providers__Plausible__BaseUrl` with its public base URL. The instance must expose `/api/v2/query`. |
| 35 | + |
| 36 | + For local development, use either a shell environment variable or .NET user secrets: |
| 37 | + |
| 38 | + ```sh |
| 39 | + dotnet user-secrets init --project path/to/Your.Umbraco.Web.csproj |
| 40 | + dotnet user-secrets set "WebAnalytics:Providers:Plausible:AccessToken" "your_stats_api_key" --project path/to/Your.Umbraco.Web.csproj |
| 41 | + dotnet user-secrets set "WebAnalytics:Providers:Plausible:BaseUrl" "https://analytics.example.com/" --project path/to/Your.Umbraco.Web.csproj |
| 42 | + ``` |
| 43 | + </Tab> |
| 44 | +</Tabs> |
| 45 | + |
| 46 | +Use the equivalent secret or app-setting facility in your hosting platform. Restart every Umbraco application instance after adding or rotating a credential. |
| 47 | + |
| 48 | +## 3. Add and test the connection |
| 49 | + |
| 50 | +As an administrator, open **Settings → Web Analytics**. |
| 51 | + |
| 52 | +1. Select **Add connection**. |
| 53 | +2. Choose Vercel or Plausible. The provider cannot be changed after creation. |
| 54 | +3. Enter the provider identifier. |
| 55 | +4. Select **Save settings**, then **Test connection**. |
| 56 | + |
| 57 | +The settings screen reports whether the shared provider credential or a connection override was detected. It does not display or store a token. |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +## 4. Verify the dashboard |
| 62 | + |
| 63 | +Open the global **Analytics** section. Check that totals and history load, then use a known date range with recorded production traffic. |
| 64 | + |
| 65 | +If reports do not load, start with [troubleshooting](/reference/troubleshooting). A provider may hide an unsupported panel; that is different from a failed connection. |
| 66 | + |
| 67 | +## Next step |
| 68 | + |
| 69 | +Configure [document analytics](/guides/document-analytics) when editors should see a report while editing a mapped document. |
0 commit comments