# Track the page

URL: https://docs.analytics.remcostoeten.nl/docs/tutorial/track-the-page

> Step 2 of 7. Send pageviews and typed custom events from the dashboard into its own project with @spoar/sdk.

The dashboard tracks itself into the project it reads, so its own visits are the first data it shows. This step adds the SDK client and a type for every custom event the page will send.

## 1. Add the client

<StepDiff
  step="2"
  notes="[
  {
    file: &#x22;src/events.ts&#x22;,
    match: &#x22;export type Events&#x22;,
    text: &#x22;Every custom event name and its properties. A track call with an unknown name or a wrong property fails to compile.&#x22;,
  },
  {
    file: &#x22;src/analytics.ts&#x22;,
    match: &#x22;endpoint: `${trimEndpoint&#x22;,
    text: &#x22;The browser client posts to endpoint exactly as given, so it gets the full /v2/events URL.&#x22;,
  },
  {
    file: &#x22;src/analytics.ts&#x22;,
    match: 'mode: settings.publicKey ? &#x22;production&#x22;',
    text: &#x22;Without a public key the client runs in development mode and logs events to the console instead of sending them.&#x22;,
  },
  {
    file: &#x22;src/analytics.ts&#x22;,
    match: &#x22;plugins: [clicks()]&#x22;,
    text: &#x22;Pageviews are on by default. clicks() adds a click event for every element with a data-spoar-click attribute.&#x22;,
  },
  {
    file: &#x22;src/app.tsx&#x22;,
    match: &#x22;analytics.shutdown()&#x22;,
    text: &#x22;shutdown() sends what is still queued, then removes the client's listeners.&#x22;,
  },
]"
/>

The client sends a pageview on load and on every `pushState` navigation. The events in `Events` are sent from step 5, once the page has controls to click.

## 2. Check that events arrive

Reload `http://localhost:3301`, then open the project in the dashboard and pick **Realtime**. The pageview shows up within a few seconds.

If nothing arrives, check the browser's network tab for the `POST` to `/v2/events`. A `403` means `http://localhost:3301` is missing from the project's allowed origins. [Events do not arrive](https://docs.analytics.remcostoeten.nl/docs/troubleshooting/no-events.md) covers the other causes.

On a real site, send events through your own domain with the [proxy](https://docs.analytics.remcostoeten.nl/docs/guides/proxy.md), so ad blockers that block third-party hosts do not drop them.

Next, [read the overview](https://docs.analytics.remcostoeten.nl/docs/tutorial/read-the-overview.md).
