---
title: Goals and A/B tests
description: Count signups, downloads and clicks as goals, and run A/B tests on people only, without cookies.
nav: Goals & A/B tests
---
# Goals and A/B tests

## Events

An event is something a reader did that you want to count: a signup, a download, a click on a pricing link. Send one
of two ways.

Mark an element; a click on it sends the event:

```html
<a href="/files/report.pdf" data-us-event="download" data-us-label="annual report">Download the report</a>
```

`data-us-label` is optional and tells events of one name apart. A link's destination host is sent with the event, so
outbound clicks show where readers went.

Or call it from your own code:

```js
usherstats.track('signup', { label: 'pricing page', value: 1 });
```

`value` is a number and defaults to 1. `usherstats.track` always exists once the snippet has loaded, and does nothing
in a browser that sends Global Privacy Control.

Never put personal data in an event's name or label: no email addresses, names or account ids.

## Goals

A goal is an event (or a page) you have named as a goal in the site's settings. Goals appear in the People and
Behaviour views, with the number of sessions that reached each one, their sources, and the paths that led there.

## A/B tests

Mark the variants in your page. Each session is assigned one variant, which is shown while the others are hidden:

```html
<div data-exp="hero-headline" data-variants="a,b">
  <h2 data-v="a">Analytics that count people</h2>
  <h2 data-v="b" hidden>Know who reads your site</h2>
</div>
```

- `data-exp` names the experiment; `data-variants` lists the variants; each child with `data-v` is one variant.
- A session is assigned by hashing it with the experiment's name, so the same tab always sees the same variant and
  nothing is stored to remember it. The same experiment marked in several places shows the same variant in each.
- A browser that sends Global Privacy Control is shown the first variant and is not counted.

Give every variant but the first the `hidden` attribute, as above, so a page shows one variant before the script
runs; the script then shows the session's variant, hides the rest, and sets `data-variant` on the block.

The **Experiments** part of the Behaviour view shows, for each variant, the sessions that saw it, how many reached the
goal you choose, the rate, and whether the difference between the two largest variants is statistically significant
(a two-proportion test). Only People sessions count: bots and your own team never enter an experiment's results.

Because a session is one tab, a person who opens a second tab is a second session and may see the other variant. That
dilutes a difference rather than creating one.
