# Switching from Google Analytics

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 Google’s:

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

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

What Google’s enhanced measurement collects, fivebar counts with the tag alone, but for site search, which takes a rule:

| In Google Analytics | In fivebar |
| --- | --- |
| Page views, history changes among them | Pageviews, each page of a [single-page app](https://fiveb.ar/docs/single-page-apps.md) among them |
| Outbound clicks, file downloads and form interactions | Links to other sites, downloads and forms sent, as [actions](https://fiveb.ar/docs/outbound-and-downloads.md) |
| Scrolls and engagement time | How far down each page was read and how long it was on screen, as [engagement](https://fiveb.ar/docs/engagement.md) |
| Site search | A [search rule](https://fiveb.ar/docs/site-search.md) in the site’s settings, naming the parameter your search uses, such as `q` |
| Video engagement | Not counted: send an event of your own |

## Events and goals

Each `gtag('event', …)` call becomes a [`tally()`](https://fiveb.ar/docs/events.md) call with the same name, and its parameters as the data:

| Google Analytics | fivebar |
| --- | --- |
| `gtag('event', 'sign_up', { method: 'email' })` | `tally('sign_up', { method: 'email' })` |
| `gtag('event', 'purchase', { value: 19.99, currency: 'GBP' })` | `tally('purchase', { revenue: 19.99, currency: 'GBP' })` |
| `dataLayer.push({ event: 'sign_up' })` | A Custom HTML tag in Tag Manager that calls `tally('sign_up')`, fired by the same trigger |

An event’s data holds text, numbers, and true or false, up to 8 names, so leave out `items` and other lists: see [Data](https://fiveb.ar/docs/events.md#data). Leave out `user_id` and user properties too: data is kept as sent, so send nothing about a person.

Every event is a goal already, so there are no key events to mark. A key event made from a page view, such as reaching `/thanks`, becomes a [page goal](https://fiveb.ar/docs/goals.md#page-goals) in the site’s settings, with `*` for anything.

## Bring the history over

Once fivebar is counting, choose Continue to Google under Import in the site’s settings and pick the property. The dashboard then reaches back before fivebar’s first day: see [Importing from Google Analytics](https://fiveb.ar/docs/import/google-analytics.md). Google counts users with a cookie, so expect its visitors to differ from fivebar’s for the same days.

---

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