Website Tracking Methods
CustomerLabs provides two primary methods for tracking user behavior on your website: Client-side (Browser) tracking and Server-side tracking. For most businesses, a hybrid approach using both methods is recommended to ensure maximum data reliability and depth.
Client-side (Browser) Tracking
Section titled “Client-side (Browser) Tracking”Client-side tracking captures user interactions directly in the browser using a JavaScript snippet. When a user visits your website, the CustomerLabs tracking script runs and captures events as they happen.
How it Works
Section titled “How it Works”- The CustomerLabs tracking snippet is added to your website’s
<head>section. - The script initializes and automatically fires a page view event.
- Interactions like clicks and form submissions are captured via the
_clJavaScript API. - Data is sent directly from the user’s browser to CustomerLabs.
Key Benefits
Section titled “Key Benefits”- Rich Behavioral Data: Easily captures UI interactions like button clicks, scrolls, and mouse movements.
- Automatic Context: Automatically collects browser-level data such as URL, referrer, and user agent.
- Real-time Attribution: Captures ad platform click IDs (like
fbclidandgclid) immediately from the URL.
Server-side Tracking
Section titled “Server-side Tracking”Server-side tracking captures events from your web server rather than the user’s browser. When an action occurs (like an order confirmation), your server sends that data directly to CustomerLabs via an API or webhook.
How it Works
Section titled “How it Works”- An action occurs on your website (e.g., a user completes a purchase).
- Your server processes the request and sends the event data to CustomerLabs.
- Data is transmitted server-to-server, bypassing the user’s browser entirely.
Key Benefits
Section titled “Key Benefits”- ITP & Ad Blocker Resilience: Since data doesn’t pass through the browser, it cannot be blocked by ad blockers or restricted by browser privacy settings like Safari’s ITP.
- Higher Data Reliability: Ensures critical events (like purchases or signups) are recorded even if the user closes their browser window early.
- Security: Sensitive data (like profit margins or internal IDs) can be processed on the server without being exposed in the browser.
Client-side vs. Server-side Tracking
Section titled “Client-side vs. Server-side Tracking”| Feature | Client-side (Browser) | Server-side |
|---|---|---|
| Data Source | User’s Browser | Your Web Server |
| Implementation | JavaScript Snippet | API / Webhooks / Plugins |
| Reliability | Affected by Ad blockers & ITP | 100% Reliable (Bypasses browser) |
| Best For | Clicks, Scrolls, Page Views | Purchases, Sign-ups, Offline actions |
| Browser Context | Native access (URL, Referrer) | Limited (Must be passed manually) |
| Privacy Support | Browser-dependent | Highly secure & compliant |
The Hybrid Approach (Recommended)
Section titled “The Hybrid Approach (Recommended)”To get the most out of your first-party data, CustomerLabs recommends a hybrid tracking setup:
- Use Client-side tracking to capture the rich behavioral journey, anonymous user identifiers, and initial ad click IDs.
- Use Server-side tracking for the bottom of the funnel events (like
PurchaseorSubscription Activated) to ensure 100% attribution accuracy and bypass browser restrictions.
CustomerLabs automatically deduplicates events if the same action (e.g., a purchase) is tracked both client-side and server-side.