# Better Auth

> Learn how to track lead conversion events with Better Auth and Dub

import LeadsIntro from "/snippets/leads-intro.mdx";
import ConversionTrackingPrerequisites from "/snippets/conversion-tracking-prerequisites.mdx";
import LeadAttributes from "/snippets/lead-attributes.mdx";
import LeadsOutro from "/snippets/leads-outro.mdx";

<LeadsIntro />

In this guide, we will be focusing on tracking new user sign-ups for a SaaS application that uses Better Auth for user authentication.

<ConversionTrackingPrerequisites />

## Installation

<Steps>

<Step title="Install the @dub/better-auth plugin">

To get started, simply install the [`@dub/better-auth` plugin](https://www.npmjs.com/package/@dub/better-auth) via your preferred package manager:

<CodeGroup>

```bash npm
npm install @dub/better-auth
```

```bash yarn
yarn add @dub/better-auth
```

```bash pnpm
pnpm add @dub/better-auth
```

```bash bun
bun add @dub/better-auth
```

</CodeGroup>

</Step>

<Step title="Configure the plugin">

Then, add the plugin to your better-auth config file:

```ts auth.ts
import { dubAnalytics } from "@dub/better-auth";
import { betterAuth } from "better-auth";
import { Dub } from "dub";

const dub = new Dub();

export const auth = betterAuth({
  plugins: [
    dubAnalytics({
      dubClient: dub,
    }),
  ],
});
```

</Step>

</Steps>

<LeadsOutro />
