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

# Analysis history

> Let shoppers revisit past scans, stored in the browser or in your own backend.

With history on, shoppers can come back to their previous scans instead of starting from scratch.

![Previous analyses with an option to start a new scan](https://mintcdn.com/getfaceage-com/wLP35CGqBY74yiOL/images/developer-guides/sdk-history.jpg?fit=max\&auto=format\&n=wLP35CGqBY74yiOL\&q=85\&s=db4493082756840a70e531d08021bdd4)

## Turn on history

```js theme={null}
const faceAge = new FaceAge({
  elementId: 'FaceAge-module',
  faceageId: '<Your Client ID>',
  history: true,
});
```

By default, history is stored in the browser (`localStorage` and cookies). Nothing else is needed.

## Store history in your backend

To make history follow a logged-in customer across devices, save scans in your own backend and pass them back with `setHistoryData`:

```js theme={null}
faceAge.API.setHistoryData({
  analysis: {
    analyze_ref_token: 'analyze_ref_abc123',
    skinAge: 28,
    damagePercentage: 12.4,
    problems: [],
  },
  activeSelections: {
    email: 'user@example.com',
    skinType: 'combination',
  },
  meta: {
    ts: Date.now(),
    image: 'https://example.com/scan.jpg',
    // Optional; values can use either 0..1 or 0..100.
    quality: {
      lightingScore: 0.92, // higher is better
      brightness: 0.53,    // used to detect lighting mismatch
      sharpnessScore: 0.88,
      blur: 0.08,          // lower is better
      noise: 0.10,         // lower is better
      confidence: 0.94,
    },
  },
});
```

> [!NOTE]
>
> `setHistoryData` requires `history: true`.

## Remove history

Remove one entry by its reference token, or pass `null` to clear all local history:

```js theme={null}
faceAge.API.removeHistoryItem('analyze_ref_abc123').then((removed) => {
  console.log('Removed:', removed);
});
```

## Next

> [card] [Compare](https://getfaceage.com/docs/developer-guides/analysis/compare.md)
>
> Compare two scans, metric by metric.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.