v2.18.0

umami-software/umamiv2.18.0May 8, 2025by mikecao

AI Summary

This release introduces a new Attribution report for tracking ad campaign effectiveness and revenue, along with a 'Distinct ID' feature to identify users via the `umami.identify` method. It also adds a `data-before-send` tracker attribute for payload manipulation and allows configuring an alternative favicon host via an environment variable.

Key Highlights

  • New Attribution report with revenue integration
  • Distinct ID feature for user identification
  • data-before-send attribute for custom payload handling
  • Alternative favicon host configuration
  • Enhanced events chart filtering

New Features

  • Attribution report
  • Distinct ID
  • data-before-send attribute
  • Events chart filtering
  • Alternative host for icons

Full Release Notes

## Features

### Attribution report

The new Attribution report allows you to trace the source origin of a user so that you can measure the effectiveness of your ad campaigns and optimize your spend. This report also integrates revenue data so you can see which channels contribute the most to your sales.

Read [docs](https://umami.is/docs/reports/report-attribution).

![image](https://github.com/user-attachments/assets/be8de1d0-9547-4200-b445-ebbbd3a4622c)

### Distinct ID

We are introducing a new property for sessions called the **distinct ID**. This is a new parameter that lets you assign a ID to a session to help you identify a user later. 

To set a distinct ID, use the `umami.identify` method from the tracker.

```js
umami.identify('bob@aol.com');
```

In a server environment, you would send an event payload with a `id` parameter.

```json
{
  "payload": {
    "hostname": "your-hostname",
    "language": "en-US",
    "referrer": "",
    "screen": "1920x1080",
    "title": "dashboard",
    "url": "/",
    "website": "your-website-id",
    "id": "bob@aol.com"
  },
  "type": "event"
}
```

You can then search the distinct ID from the Sessions screen.

![image](https://github.com/user-attachments/assets/c4e6f6bc-2d61-40cb-bea2-31bce8204872)

Read [docs](https://umami.is/docs/distinct-ids).

### data-before-send attribute

We are introducing a new tracker attribute **`data-before-send`** that let's you define a function that will be called before data is sent. You can then inspect and modify the payload or cancel the send entirely. The function will take two parameters, `type` and `payload`. To continue with sending, you return a payload object. To cancel the send, return a false-y value.

First, define the function to be called.

```js
function beforeSendHandler(type, payload) {
  if (checkPayload(payload)) {
    return payload;
  }
  return false;
}
```

Then pass the name of the function using the `data-before-send` attribute.

```html
<script defer
  src="/script.js"
  data-website-id="7801d46c-afd2-424c-8680-4ea713b2002a"
  data-before-send="beforeSendHandler"></script>
```

### Events chart filtering

You can now filter custom events by clicking on an item in the events table.

![umami2](https://github.com/user-attachments/assets/0b3a8c13-ca56-4ffb-adbb-094079bf20b4)

### Alternative host for icons

The default host we use for displaying website favicons is `icons.duckduckgo.com`. Now you can use an alternative host with the environment variable `FAVICON_URL`. You need to pass a string with a token to replace the domain name. For example:

`https://icons.duckduckgo.com/ip3/{{domain}}.ico`

Some alternatives you can use:

`https://www.google.com/s2/favicons?domain={{domain}}`
`https://logo.clearbit.com/{{domain}}`

## Migrations

This release includes some database migrations that add new columns for handling UTM parameters. The migrations will
automatically run during the build process.

The migrations will only apply the new schema but not do any migration of old data.  The reason for this is we didn't 
want to hang up the build process for users with lots of data. Instead we will be providing scripts that you can run to migrate your
data separately.

To migrate your data for this release, use the SQL for your database from [here](https://raw.githubusercontent.com/umami-software/umami/901a6c558a7630df8fc33af4fad96f397e964474/scripts/data-migrations/convert-utm-clid-columns.sql)

## Fixes
- Empty event search #3329
- Realtime activity details not listed from newest to oldest #3330
- POST /api/auth/very Method not allowed | Outdated documentation? #3339
- Null region breaks Insights Report #3344
- Docker middleware #3357 
- CORS errors in Docker #3307 
- API requests are ignored if User-Agent is empty #3337
- Referrer data displayed in every table #3284
- Realtime View Graph and Activity are not in sync #3244

## Updates
- Upgraded Next to `15.3.1`
- Upgraded Prisma to `6.7.0`

## Thanks

@harryo @Cibiyanna26 @YoSev @Maxime-J @perso182 @astappiev @thomasdn @YektaDev @gjelbrim