# Switching from Matomo

Swap the tag, carry your events and goals across, and bring the site’s history with it.

## Add the tag

[Add the site](https://fiveb.ar/docs/install.md#add-the-site), then put fivebar’s tag in the `<head>` of every page, beside Matomo’s tracking code:

```
<script async data-domain="example.com" src="https://fiveb.ar/js/tally.js"></script>
```

With Matomo Tag Manager, add fivebar’s there instead, as [Platforms](https://fiveb.ar/docs/platforms.md#matomo-tag-manager) shows. Run both for a few weeks to compare the same days, then remove Matomo’s code.

Much of what you push to `_paq` has nothing to replace, or becomes an attribute on fivebar’s tag:

| In Matomo | In fivebar |
| --- | --- |
| `enableLinkTracking` | Nothing: links to other sites and downloads are counted with the tag alone, as [actions](https://fiveb.ar/docs/outbound-and-downloads.md) |
| `enableHeartBeatTimer` | Nothing: how long each page was on screen is counted as [engagement](https://fiveb.ar/docs/engagement.md) |
| `setCustomUrl` | [`data-path="/login/:token"`](https://fiveb.ar/docs/script-attributes.md#data-path) on the tag |
| `setCustomDimension` | [`data-property-author="Ada"`](https://fiveb.ar/docs/script-attributes.md#data-property-name) on the tag |
| Site search, from the address | A [search rule](https://fiveb.ar/docs/site-search.md) in the site’s settings, naming the parameter, such as `q` |
| `trackSiteSearch` | [`data-search`](https://fiveb.ar/docs/script-attributes.md#data-search) and [`data-search-results`](https://fiveb.ar/docs/script-attributes.md#data-search-results) on the tag |
| Excluded IPs | [Excluded traffic](https://fiveb.ar/docs/excluding-traffic.md) in the site’s settings |

## Events and goals

Each `trackEvent` becomes a [`tally()`](https://fiveb.ar/docs/events.md) call named for its action, with its category, name and value as the data:

| Matomo | fivebar |
| --- | --- |
| `_paq.push(['trackEvent', 'Videos', 'Play', 'Intro', 1])` | `tally('Play', { category: 'Videos', name: 'Intro', value: 1 })` |
| `_paq.push(['trackGoal', 1])` | `tally('Signup')`, named for what it counts |
| `_paq.push(['trackEcommerceOrder', 'A100', 19.99])` | `tally('Purchase', { revenue: 19.99, currency: 'EUR' })` |

Every event is a goal already. A goal Matomo matches by URL, such as a visit to `/thanks`, becomes a [page goal](https://fiveb.ar/docs/goals.md#page-goals) in the site’s settings, with `*` for anything. Leave out `setUserId`: an event’s data is kept as sent, so send nothing about a person.

## Bring the history over

Once fivebar is counting, choose Import from Matomo under Import in the site’s settings, with Matomo’s address, the site’s ID and an auth token. The dashboard then reaches back before fivebar’s first day: see [Importing from Matomo](https://fiveb.ar/docs/import/matomo.md).

---

fivebar is web analytics without cookies, at https://fiveb.ar. Every page of its docs is listed at https://fiveb.ar/docs/index.md.
