Setting up goals and conversions
Count sign-ups, purchases, downloads or button clicks.
Goal types
- Pageview: converts when a visitor reaches a page, such as
/thank-youafter checkout. - Scroll percentage: converts when a visitor scrolls to a set percentage of a page, for example 75% of an article.
- Scroll until element: converts when an element matching a CSS selector comes into view, for example
#pricingorfooter. - Click on element: converts when a visitor clicks an element matching a CSS selector, for example
.buy-buttonor#download. - Webhook: your server sends a POST request to a private URL to record a conversion, which is ideal for payments or back-end events.
- Custom: you trigger the conversion yourself with a line of JavaScript.
Create a goal
- Open your website's dashboard and click Goals.
- Choose the option to create a new goal.
- Give it a clear name, for example "Newsletter sign-up".
- Pick the goal type and fill in its details: the page path, the scroll percentage, or the CSS selector.
- Optionally, set a conversion value, for example 49.90 for a product sale.
- Save. Conversions will start appearing as soon as visitors complete the action.
Custom goals with JavaScript
When you create a custom goal, the dashboard shows you the exact code to use. It looks like this:
my_analytics.goal('my-goal');
For example, on a button:
<button type="button" onclick="my_analytics.goal('my-goal')">Click me</button>
Replace my-goal with your goal's key, and always copy the snippet shown in your dashboard.
Webhook goals
- Create a goal and choose Webhook.
- Edit the goal to see its private webhook URL.
- Send a POST request to that URL from your server. You can send JSON or form data, or an empty POST. To record a specific amount, send it as a value:
{"value": 49.90}
Webhook conversions record only the time and the value. They aren't linked to visitors or pages, so visitor and page filters don't apply to them.
Reading your results
- The goals chart shows conversion counts as a line and total goal values as bars.
- Hover over a goal in the list to see its total value.
- Set your website's currency in its settings so values display correctly. Changing the currency doesn't convert amounts you've already recorded.
Tips
- Changing a goal's value only affects new conversions, not past ones.
- How many goals you can create depends on your plan.
- More details are in the Goals reference.