Goal Tracking
Track conversions and custom goals
Track conversions, signups, purchases, and other important actions on your website with PureStats goal tracking.
What are Goals?
Goals help you measure how often visitors complete specific actions on your website. Common goals include:
- Newsletter signups
- Account registrations
- Purchases or checkouts
- Contact form submissions
- File downloads
- Specific page visits (e.g., "Thank You" page)
Creating a Goal
To create a goal in PureStats:
- Go to your site's dashboard
- Click on Settings (gear icon)
- Navigate to the Goals tab
- Click Add New Goal
- Enter a goal name and select the trigger type
Goal Types
Pageview Goals
Track when visitors reach a specific page. Perfect for "Thank You" pages after form submissions or purchases.
Example: Set the path to /thank-you to track when visitors reach your thank you page after signing up.
Custom Event Goals
Track specific actions using JavaScript. First, add the tracking code to your website, then trigger the event:
// Trigger the goal when a button is clicked
document.querySelector('#signup-btn').addEventListener('click', function() {
purestats('Signup')
})
Or use inline event handlers:
<button onclick="purestats('Signup')">Sign Up</button>
Setting Up Event Tracking
Before tracking events, make sure the purestats function is available:
// Initialize purestats if not already loaded
window.purestats = window.purestats || function() {
(window.purestats.q = window.purestats.q || []).push(arguments)
}
// Now you can track events
purestats('Signup')
Common Goal Examples
Track Newsletter Signup
<form onsubmit="purestats('Newsletter Signup')">
<input type="email" placeholder="Your email" required>
<button type="submit">Subscribe</button>
</form>
Track Purchase
// After successful purchase
purestats('Purchase', {
props: {
product: 'Premium Plan',
value: 99.00,
currency: 'EUR'
}
})
Track File Download
<a href="/files/guide.pdf" onclick="purestats('Download', {props: {file: 'guide.pdf'}})">
Download Guide
</a>
Viewing Goal Data
Once goals are set up, you can view them in your dashboard:
- See total conversions over time
- View conversion rate (conversions / visitors)
- Filter by date range to analyze trends
- Compare goal performance across different periods
Tip: Goal names must match exactly between your JavaScript code and the goal configuration. Signup and signup are different goals.