---
title: "Quick start"
description: "Create a client token, add the EZGH browser SDK to a web app with npm, React, Next.js, Vue, Angular or a script tag, and see your first page loads and errors."
---

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

# Quick start

1. **Create a client token.**

   In the console, open **Observability** > **Real user monitoring** > **Browser apps** and click
   **Add browser app**. Choose the environment, name the application, and list the origins your
   pages are served from (one per line). The app's **Setup** tab then shows the code below with
   your token filled in.

   Or with the CLI:

   ```sh
   ezgh obs browser-apps tokens create --application storefront --environment production \
     --origin https://shop.example.com --origin 'http://localhost:*'
   ```

   The token, `ezgh_ct_…`, is printed with the rest of the token's settings. See
   [Client tokens](/observability/rum/client-tokens).

2. **Install the SDK.** Call `init` as early as you can, once, with the token and your build's
   version as `release`. The release is what matches errors to your source maps, and what tells a
   regression in a new release from an old tab still running the last one; set it from your build
   (a version or a commit SHA).

### npm

```sh
npm i @ezghcloud/rum
yarn add @ezghcloud/rum
pnpm add @ezghcloud/rum
bun add @ezghcloud/rum
```

```ts
// In your entry module, before the rest of your app
import { init } from "@ezghcloud/rum";

init({ token: "ezgh_ct_…", release: import.meta.env.VITE_RELEASE });
```

Single-page apps get a view per route change, named by the path with IDs replaced
(`/users/:id`). The framework packages name views by your router's route templates.
### React

```sh
npm i @ezghcloud/rum @ezghcloud/rum-react
yarn add @ezghcloud/rum @ezghcloud/rum-react
pnpm add @ezghcloud/rum @ezghcloud/rum-react
bun add @ezghcloud/rum @ezghcloud/rum-react
```

```tsx
// main.tsx, with React Router's data router
import { init } from "@ezghcloud/rum";
import { EzghErrorBoundary, instrumentReactRouter } from "@ezghcloud/rum-react";
import { createRoot } from "react-dom/client";
import { createBrowserRouter, RouterProvider } from "react-router";
import { routes } from "./routes";

init({ token: "ezgh_ct_…", release: import.meta.env.VITE_RELEASE });

const router = createBrowserRouter(routes);
instrumentReactRouter(router); // views are named by route pattern: /users/:id

createRoot(document.getElementById("root")!).render(
  <EzghErrorBoundary fallback={<p>Something went wrong.</p>}>
    <RouterProvider router={router} />
  </EzghErrorBoundary>,
);
```

`@ezghcloud/rum-react` needs React 18 or later and React Router 7 or later. Its exports:

- `EzghErrorBoundary`: reports render errors with React's component stack. `fallback` is a
node or `(error, reset) => node`; `attributes` adds attributes to the errors it reports.
- `instrumentReactRouter(router)`: names views by route pattern, for data routers
(`createBrowserRouter`). It returns a function that stops it.
- `useEzghRouteTemplate()`: names views from the route params, in framework mode or any
tree under a router.
- `useEzghView(name)`: starts a view named `name`.
### Next.js

```sh
npm i @ezghcloud/rum @ezghcloud/rum-nextjs
yarn add @ezghcloud/rum @ezghcloud/rum-nextjs
pnpm add @ezghcloud/rum @ezghcloud/rum-nextjs
bun add @ezghcloud/rum @ezghcloud/rum-nextjs
```

For the App Router, Next.js 15.4 or later.

```tsx
// app/layout.tsx
import { EzghRum } from "@ezghcloud/rum-nextjs";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        <EzghRum token="ezgh_ct_…" release={process.env.NEXT_PUBLIC_RELEASE} />
        {children}
      </body>
    </html>
  );
}
```

`<EzghRum>` starts the SDK once and names views by route template (`/users/:id`,
`/docs/:slug*`). Report the errors your error pages catch:

```tsx
// app/error.tsx and app/global-error.tsx
"use client";
import { useEzghErrorReport } from "@ezghcloud/rum-nextjs";

export default function Error({ error, reset }: { error: Error; reset: () => void }) {
  useEzghErrorReport(error);
  return <button onClick={reset}>Try again</button>;
}
```

Upload source maps from `next build`:

```ts
// next.config.ts
import { withEzghRum } from "@ezghcloud/rum-nextjs/config";

export default withEzghRum({ /* your config */ }, { application: "storefront" });
```

`withEzghRum` adds debug IDs to the client bundles after the production build, uploads their
source maps (with `EZGH_API_KEY`, `EZGH_ORG`, `EZGH_PROJECT` and the release in
`EZGH_RUM_RELEASE`; see [Source maps](/observability/rum/source-maps)) and removes the maps from
the output, so they're never served. It also has Next.js render `<meta name="traceparent">`,
so the page load joins your server's trace when the server is instrumented:

```ts
// instrumentation.ts
export async function register() {
  const { registerOTel } = await import("@vercel/otel");
  registerOTel({ serviceName: "storefront" });
  const { ezghTraceparent } = await import("@ezghcloud/rum-nextjs/instrumentation");
  await ezghTraceparent();
}
```
### Vue

```sh
npm i @ezghcloud/rum @ezghcloud/rum-vue
yarn add @ezghcloud/rum @ezghcloud/rum-vue
pnpm add @ezghcloud/rum @ezghcloud/rum-vue
bun add @ezghcloud/rum @ezghcloud/rum-vue
```

```ts
// main.ts
import { createApp } from "vue";
import { createEzghRum } from "@ezghcloud/rum-vue";
import App from "./App.vue";
import { router } from "./router";

const app = createApp(App);
app.use(router);
app.use(createEzghRum({ token: "ezgh_ct_…", release: import.meta.env.VITE_RELEASE, router }));
app.mount("#app");
```

`createEzghRum` takes the [`init` options](/observability/rum/configuration) plus `router`
(Vue Router 4, optional). It reports errors from Vue's error handler, keeping any
`app.config.errorHandler` you set, and names views by route template.
### Angular

```sh
npm i @ezghcloud/rum @ezghcloud/rum-angular
yarn add @ezghcloud/rum @ezghcloud/rum-angular
pnpm add @ezghcloud/rum @ezghcloud/rum-angular
bun add @ezghcloud/rum @ezghcloud/rum-angular
```

```ts
// app.config.ts
import { ApplicationConfig } from "@angular/core";
import { provideRouter } from "@angular/router";
import { provideEzghRum } from "@ezghcloud/rum-angular";
import { environment } from "../environments/environment";
import { routes } from "./app.routes";

export const appConfig: ApplicationConfig = {
  providers: [provideRouter(routes), provideEzghRum({ token: "ezgh_ct_…", release: environment.release })],
};
```

For Angular 19 or later. `provideEzghRum` starts the SDK when the app starts, names views by
route, and provides `EzghErrorHandler`, which reports each error and then calls Angular's
default handler.
### Script tag

```html
<!-- In <head>, before your app's scripts -->
<script src="https://cdn.jsdelivr.net/npm/@ezghcloud/rum@1.0.0/dist/rum.iife.js"
        integrity="sha384-RG4hDRdHe2euZZluxOe4k42GM7u496jg/z65MzgKOp0z9M1PAwJovHBqgmVUObj0" crossorigin="anonymous"></script>
<script>
  EzghRum.init({ token: "ezgh_ct_…", release: "2026.10.13-4f2a9c1" });
</script>
```

The script tag defines `window.EzghRum`, with the same functions as the npm package. Pin the
exact version, with the `integrity` hash from that version's release notes in the
[ezgh-rum-js repository](https://github.com/ezgamehost/ezgh-rum-js/releases).

3. **Upload source maps** so errors show your files, functions and lines instead of minified
   code. Add the build plugin, or run `ezgh obs sourcemaps` after your build; see
   [Source maps](/observability/rum/source-maps). Upload a release's maps before you deploy it.

4. **See your data.** Open your app and click around. Within a minute, **Real user monitoring** >
   **Performance** shows the page loads and Web Vitals. To see an issue, run
   `setTimeout(() => { throw new Error("RUM test") })` in the browser's console: it shows under
   **Issues**. The **Setup** tab's last step says when the first page view arrived.

> **Note**
>
> The token is public: it's meant to be in your pages. Its allowed origins and limits are what
> protect it. Don't put an ingest key (`ezgh_ik_…`) or an API key in a page.

Next: [send through your own domain](/observability/rum/tunnel) so ad blockers don't drop the
data, [trace requests to your APIs](/observability/rum/configuration#tracing-to-your-apis), and
[alert on new issues](/observability/rum/issues#alerts).

Source: https://docs.ezghcloud.com/observability/rum/quick-start/index.mdx
