Flare by Spatie
    • Error Tracking
    • Performance Monitoring
    • Logs
  • Pricing
  • Docs
  • Insights
  • Changelog
  • Back to Flare ⌘↵ Shortcut: Command or Control Enter
  • Sign in
  • Try Flare for free
  • Error Tracking
  • Performance Monitoring
  • Logs
  • Pricing
  • Docs
  • Insights
  • Changelog
    • Back to Flare ⌘↵ Shortcut: Command or Control Enter
    • Try Flare for free
    • Sign in
Flare Flare Laravel Laravel PHP PHP JavaScript JavaScript React React Vue Vue Svelte Svelte Protocol Protocol
  • General
  • Installation
  • CDN installation
  • Resolving bundled code
  • API reference
  • Electron
  • How it works
  • Errors
  • Reporting errors
  • Client hooks
  • Logs
  • Introduction
  • Levels
  • Attributes
  • Data Collection
  • Adding custom context
  • Adding glows
  • Identifying users

Identifying users

When a user is logged in to your application and an error or trace occurs, you can attach information about that user to the report so you can see who was affected in Flare.

Call flare.setUser() once you know who the user is (after login, on app boot, in a route guard, etc.):

import { flare } from '@flareapp/js';

flare.setUser({
    id: 123,
    email: '[email protected]',
    fullName: 'Jane Doe',
});

The following fields are recognised:

Field Attribute sent Description
id user.id The user's unique identifier. Used to group occurrences.
email user.email Shown as the user's label, with a Gravatar.
fullName user.full_name Shown as the user's label when no email is present.

All fields are optional. Provide whichever you have; id is what links occurrences to a single user.

Sending extra attributes

Any additional keys you pass are collected under user.attributes and shown alongside the user in Flare:

flare.setUser({
    id: 123,
    email: '[email protected]',
    fullName: 'Jane Doe',
    plan: 'pro',
    teamId: 42,
});

Here plan and teamId are sent as user.attributes.

Clearing the user

When the user logs out, clear the attached user by passing null:

flare.setUser(null);

Per-request scope (Node)

In @flareapp/node, setUser() attaches the user to the current request scope, so concurrent requests do not share or leak each other's user. Call it inside your request handler (typically within runWithContext(...)). See the @flareapp/node README for details on request-scoped context:

import { flare } from '@flareapp/node';

flare.setUser({ id: user.id, email: user.email, fullName: user.name });
Adding glows Installation
  • On this page
  • Sending extra attributes
  • Clearing the user
  • Per-request scope (Node)

Catch errors and fix slowdowns with Flare, the full-stack application monitoring platform for Laravel, PHP & JavaScript.

  • Platform
  • Error Tracking
  • Performance Monitoring
  • Pricing
  • Support
  • Resources
  • Insights
  • Newsletter
  • Changelog
  • Documentation
  • Affiliate program
  • uptime status badge Service status
  • Terms of use
  • DPA
  • Privacy & cookie Policy
Made in by
Flare