Event Tracking
Track events and conversions from your links
Track events on your website and attribute them to your short links to understand visitor behavior and measure conversions.
What is an Event?
An event is any action a visitor takes on your website:
- Viewing a page
- Creating an account
- Making a purchase
- Submitting a form
- Downloading a resource
Events become conversions when you designate them as valuable. See Conversions to configure which events count as conversions.
Setting Up Event Tracking
1. Install the Tracking Pixel
Add our JavaScript tracking pixel to your website. See the Tracking Pixel guide for installation instructions.
2. Page Views
The installation snippet includes a page_view event that fires on every page load. This is already set up when you install the tracking pixel.
3. Track Events
Use the qklnk.event() function to track events:
// Track a simple event
qklnk.event('subscribe');
// Track a purchase with revenue
qklnk.event('purchase', {
value: 99.99,
currency: 'USD'
});
Event Properties
The second argument to qklnk.event() accepts the following properties:
| Property | Type | Default | Description |
|---|---|---|---|
value |
number | 0 |
Monetary value of the event (e.g., purchase amount) |
name |
string | null |
Label for the event (e.g., product name, page title, subscription name) |
currency |
string | 'USD' |
ISO 4217 currency code (e.g., USD, EUR, GBP) |
metadata |
object | {} |
Custom data including nested objects and arrays |
Note: page_url and referrer are automatically captured and included with every event.
Callback
The optional third parameter is a callback function that executes when the event tracking completes:
// Redirect after event is tracked
qklnk.event('add_to_cart', { value: 29.99 }, function(success) {
if (success) {
window.location.href = '/checkout';
}
});
// Log failures
qklnk.event('purchase', { value: 99.99 }, function(success) {
if (!success) {
console.error('Failed to track purchase');
}
});
The callback receives true if the event was successfully recorded, false if it failed.
// All properties together
qklnk.event('purchase', {
value: 149.99,
name: 'Pro Plan',
currency: 'USD',
metadata: {
id: 'ORD-12345',
source: 'homepage'
}
});
Deduplication: Include a unique id in metadata to prevent duplicate events from page refreshes or retries. Events with the same metadata.id, visitor, and event type will only be recorded once.
Customizing Page Views
The page_view event automatically sets the name property to document.title, so page titles appear in the Name column without any extra configuration.
To override the name or add custom metadata:
qklnk.event('page_view', {
name: 'Custom Page Name',
metadata: {
section: 'blog',
author: 'John Doe'
}
});
Identifying Users
Link anonymous visitors to known users after they sign up or log in. This connects all their previous visits to their identity, enabling you to see the full customer journey.
// Identify after login/signup
qklnk.identify('[email protected]', {
email: '[email protected]',
first_name: 'John',
last_name: 'Doe'
});
// Identify with just an email (email trait auto-set)
qklnk.identify('[email protected]');
// Identify with a user ID and traits
qklnk.identify('usr_12345', {
email: '[email protected]',
first_name: 'John',
last_name: 'Doe',
plan: 'pro',
company: 'Acme Inc'
});
// Clear identity on logout
qklnk.identify(null);
Identify Properties
The first argument is the user ID (typically email or your internal user ID). The second argument accepts these standard traits:
| Trait | Type | Description |
|---|---|---|
email |
string | User's email address (auto-set if userId contains @) |
first_name |
string | User's first name |
last_name |
string | User's last name |
| custom | any | Any additional traits you want to store (plan, company, etc.) |
When to Call Identify
- After signup - Immediately after a user creates an account
- After login - When a returning user logs in
- After purchase - When you collect the customer's name and email at checkout
- On page load - If user is already authenticated, identify them on each page
// Example: Identify on page load if user is logged in
Viewing Events
View your tracked events in several places:
- Analytics Dashboard - See total events, conversions, and revenue
- Link Details - See events attributed to each link
- Team Overview - See events across all links
When a visitor has been identified, their name appears next to the visitor ID in the expanded event view. Hover over the name to see their email, and click to copy it.
Next Steps
- Conversions - Configure which events count as conversions
- Attribution - Learn how conversions are attributed to clicks