# Goals and conversions

> Define what success means on your site — page visits, clicks, form submits, events or revenue — so reports can measure it.

A goal is what counts as success on your site: an order, a signup, a demo request. Conversion rates, rule results and A/B test verdicts are all measured in goals, so set them up before anything else in analytics.

## Creating a goal

Open **Goals** in the dashboard and add one. Pick the type that matches how the success shows up:

| Type | Completed when | You set |
| --- | --- | --- |
| **Page visit** | A visitor reaches a page, such as an order confirmation or thank-you page. | The URL, and how to match it: equals, contains, starts with, ends with or regex. |
| **Element click** | A visitor clicks something: a button, a link, a CTA. | The element's CSS selector. |
| **Form submit** | A visitor submits a form. | The form's selector, or nothing to count any form. |
| **Conversion from code** | Your code calls `GeoEngage.trackConversion()` with this name. | The event name. |
| **Revenue** | A purchase with an amount. Counts conversions and adds up their value. | The event name. |

The first three need no code: they are counted from the page views, clicks and form submits GeoEngage already records. The last two are sent by your code, with `trackConversion`. A [`trackEvent`](https://geoengage.app/docs/widget/methods#trackevent) call never completes a goal:

```js
// A Conversion from code goal named "signup"
GeoEngage.trackConversion('signup');

// A Revenue goal named "purchase"
GeoEngage.trackConversion('purchase', 99.0, { orderid: 'ORD-12345' });
```

See [`trackConversion`](https://geoengage.app/docs/widget/methods#trackconversion) for the details.

## Marking an element instead of describing it

An **Element click** goal takes any CSS selector, so you can label the element in your markup rather than describe where it sits on the page:

```html
<button data-ge-goal="checkout">Buy now</button>
```

Then create an Element click goal with the selector `[data-ge-goal="checkout"]`.

This is usually better than a positional selector. `.hero > div:nth-child(3) button` breaks the next time someone reorders the page, and it breaks silently — the goal keeps existing and reports zero. An attribute you put there on purpose survives a redesign, and it tells the next developer that something depends on that button.

A click anywhere inside the element counts too, so a click on an icon or a `<span>` within the button still completes the goal.

## Counting on one page only

Element click and Form submit goals have an **Only on page** field under the selector. Left empty, the goal counts on every page of your site, which is right for a selector that names the element.

Set it when the selector describes a position. If you pick a button on `/pricing` and the selector comes back as `main > section:nth-of-type(2) > button`, that same position is some other button on your home page, and without a page both would count. Picking an element fills this in for you in that case.

Use `/pricing` for one page, or `/products/*` for every page under `/products/`. The query string and a trailing slash are ignored. For a Form submit goal with no selector, it means "any form on this page".

## Custom parameters

The code-based goal types take a third argument of extra detail about the conversion:

```js
GeoEngage.trackConversion('purchase', 99.0, {
  plan: 'pro',
  currency: 'USD',
  orderid: 'ORD-12345',
});
```

The goal's own page lists each parameter and its most common values, so you can see which plan sells or which currency people pay in without adding a goal per case.

Keep parameter names lowercase — letters, numbers, `_` and `-`. Names are stored lowercase, so `orderId` and `orderid` are the same parameter and appear as `orderid`. Values are kept as you send them.

Send detail that describes the conversion, not the person: a plan name or a currency, not an email address or a payment token.

## How goals are counted

- **Conversion rate** is the share of visits that completed the goal at least once.
- **Completions** count repeats within a visit too: a visitor who buys twice is two completions, one converted visit.
- A **Revenue** goal also sums `value` across completions.

A `trackConversion()` call with a name no goal uses is recorded, but no report counts it. The **Goals** page lists these unclaimed names, so you can turn one into a goal, and the goal then counts the calls already recorded.

## When a goal starts counting

It depends on what the goal is matched against.

| Type | Counts | Change the rule | Switch it off |
| --- | --- | --- | --- |
| **Page visit**, **Conversion from code**, **Revenue** | Every matching page view or `trackConversion()` call on record, including visits from before the goal existed. | Past visits are counted by the new rule. | It counts nothing, for any date, until you switch it on again. |
| **Element click**, **Form submit** | From the moment the goal is saved. | The new selector applies to clicks and submits from then on. | New completions stop being recorded; the ones already recorded still count. |

The first group is worked out from page views and `trackConversion()` calls that are stored anyway, each time a report runs, so a new or changed goal shows up in reports for past dates within about a minute. The second group can only be decided on the page, at the moment of the click, so create those goals early.

Deleting a goal follows the same split: a deleted Page visit or code goal no longer counts anywhere, and recreating it brings its numbers back. Completions already recorded for a deleted Element click or Form submit goal stay in your conversion rate and are listed as "Deleted goal".

## Where goals show up

- **Goals** lists every goal with its conversion rate, how long it takes to convert, and whether it is still firing. Opening one gives its rate over time and which groups of visitors complete it more or less often than the rest.
- **Funnels** can use a goal as the last step of a sequence, to see where visitors drop out on the way to it. See [Funnels](https://geoengage.app/docs/analytics/funnels).
- **Rules & A/B Tests** judges rules and variants on a goal. Pick the goal as the **Success Goal** of an [A/B test](https://geoengage.app/docs/rules/ab-tests).
- The [holdout's](https://geoengage.app/docs/rules/holdouts) personalization lift is measured on your goals too.

---

Source: https://geoengage.app/docs/analytics/goals
