Goals
A goal tracks actions not covered by existing analytics, like button clicks, downloads, or specific page views such as a thank-you page after checkout.
Pageview
The pageview goal is easy to set up. It converts when a visitor reaches a specified page.
For example, a 'thank you' page after a conversion (newsletter, purchase, form submission).
Custom
Custom goals require extra code, specified when you create a new goal from the dashboard.
Use custom goals to track specific events not covered by pageview goals.
Examples of custom goals:
- Tracking clicks on external links
- Tracking advanced form submissions
- Tracking clicks on specific page parts
Example of a JavaScript snippet for goal tracking:
analytics.goal('my-goal');
When this code triggers, the goal conversion is recorded.
Example of code integrated into a button to trigger the Goal event:
<button type="button" onclick="analytics.goal('my-goal')">Click me</button>