StartupKitstartupkit
AnalyticsUsage

reset

Clear user identity

Clear the current user identity on logout.

Client

Use the useAnalytics hook in client components:

import {  } from "@repo/analytics"

const {  } = ()

Usage

()

No parameters. Clears the user identity across all analytics providers.

Examples

On logout

"use client"

import {  } from "@repo/analytics"
import {  } from "@repo/auth"

export function () {
  const {  } = ()
  const {  } = ()

  async function () {
    await ()
    ()
  }

  return < ={}>Sign Out</>
}

With AuthProvider

The AuthProvider can automatically reset on logout:

app/providers.tsx
<
  ={() => ()}
>
  {}
</>

Account switching

async function (: string) {
  ()
  
  const  = await ()
  
  (., {
    : .,
    : .
  })
}

Server

Reset is client-only. It clears browser-side state (cookies, local storage) used by analytics providers.

For server-side logout tracking:

await ({
  : "USER_SIGNED_OUT",
  : .,
  : {
    : .,
    : .
  }
})

Why reset matters

Always call reset() when a user signs out to:

  • Prevent events from being attributed to the wrong user
  • Clear stored user properties in the browser
  • Start a fresh anonymous session
  • Comply with privacy requirements

On this page