Website Analytics and Tracking Guide
You can’t improve what you don’t measure. But measuring wrong is sometimes worse than not measuring at all, because it leads to confident decisions based on flawed data.
Most websites have some form of analytics installed. Fewer have it configured correctly.
Why analytics tracking matters
Analytics tells you:
- Where visitors come from (organic, paid, social, referral)
- What they do on your site (pages viewed, time spent, actions taken)
- Where they drop off (funnel analysis, exit pages)
- What converts (which channels, pages, and campaigns drive results)
Without this data, you’re guessing. With bad data, you’re confidently wrong.
The core tracking stack
Modern websites typically need multiple tracking tools, each with a purpose:
Google Analytics 4 (GA4)
The foundation. GA4 tracks:
- Pageviews and sessions
- User behavior and engagement
- Traffic sources
- Conversions and goals
Unlike Universal Analytics (the old version), GA4 is event-based. Everything is an event: pageviews, clicks, form submissions, purchases.
Configuration you need:
- Data streams for web (and apps if applicable)
- Cross-domain tracking if you have multiple domains
- Enhanced measurement events enabled
- Conversion events defined
Google Tag Manager (GTM)
The delivery mechanism. Instead of adding tracking scripts directly to your site, GTM gives you:
- Centralized management: One script, many tags
- Version control: Roll back if something breaks
- Preview mode: Test before publishing
- No code changes: Marketing can add tags without developers
GTM deploys GA4, but also Meta Pixel, LinkedIn, and any other tracking script.
Best practice: Use GTM for all third-party scripts. Direct implementation creates maintenance headaches.
Meta Pixel (Facebook/Instagram)
Required for:
- Facebook/Instagram ad tracking
- Retargeting audiences
- Conversion tracking
The pixel fires when someone visits your site, letting Meta track the user journey from ad click to conversion.
Other common pixels
- LinkedIn Insight Tag: B2B advertising and demographics
- Twitter/X Pixel: Twitter ad tracking
- TikTok Pixel: TikTok ad attribution
- Google Ads Conversion Tracking: Google Ads performance
Common implementation mistakes
1. Multiple GA4 installations
The most common issue. Happens when:
- Different developers add GA4 separately
- GTM and hardcoded GA4 both run
- Multiple GTM containers exist
Result: Double-counted pageviews, inflated metrics, unreliable data.
Fix: Use our Analytics Tracker Checker to detect duplicates.
2. Missing GTM noscript fallback
GTM’s container snippet has two parts:
<!-- In <head> -->
<script>
(function (w, d, s, l, i) {
/* ... */
})(window, document, 'script', 'dataLayer', 'GTM-XXXX');
</script>
<!-- Immediately after <body> -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXX"></iframe></noscript>
Many sites include only the first part. The noscript fallback matters for users with JavaScript disabled (rare but real) and shows GTM you’ve implemented correctly.
3. No data layer
A data layer is a JavaScript object that passes information to GTM:
window.dataLayer = window.dataLayer || [];
dataLayer.push({
event: 'purchase',
transactionId: 'T12345',
transactionTotal: 99.99,
currency: 'USD',
});
Without a data layer, you can only track basic pageviews. With one, you can:
- Track e-commerce transactions with full details
- Pass user properties (logged in, customer tier)
- Fire custom events based on user actions
4. Broken pixel implementation
Pixels can break silently:
- Ad blockers prevent loading (nothing you can do)
- Incorrect IDs (typos, test vs production)
- Consent blocking without fallback
- JavaScript errors preventing execution
5. No consent management
GDPR, CCPA, and other regulations require consent before tracking. But “blocking everything until consent” means losing data on users who never interact with the consent banner.
Modern approach: Load GA4 with consent mode. It collects anonymous data by default, then unlocks full tracking when consent is granted.
Verifying your tracking setup
Check your site
Use our Analytics Tracker Checker to scan any page for:
- GA4 and GTM installation
- Meta, LinkedIn, and other pixels
- Data layer presence
- Common implementation issues
It shows exactly what’s installed and what’s missing.
Browser developer tools
For manual verification:
- Network tab: Filter by “google” or “facebook” to see requests
- Console: Type
dataLayerto see GTM’s data - Elements: Search for gtag or GTM scripts
GTM preview mode
GTM’s built-in debugger shows:
- What tags fired (and which didn’t)
- What triggered each tag
- What data was passed
Access it from GTM’s interface with the “Preview” button.
GA4 DebugView
GA4’s Realtime reports show live data, but DebugView shows individual events with full parameters. Enable debug mode with a browser extension or URL parameter.
Events you should track
Beyond basic pageviews, configure these events:
Engagement events
- Scroll depth (25%, 50%, 75%, 100%)
- Time on page thresholds
- Video plays and completions
- File downloads
Conversion events
- Form submissions (contact, newsletter, demo request)
- Button clicks (CTAs, add to cart)
- Purchases with transaction data
- Sign-ups and account creations
User journey events
- Page views on key pages (pricing, features)
- Navigation clicks
- Search queries
- Error pages (404s)
Setting up conversions
In GA4, any event can become a conversion. But choose wisely:
Good conversions:
- Purchase completed
- Demo requested
- Contact form submitted
- Free trial started
Bad conversions (too frequent):
- Page viewed
- Button clicked
- Scroll happened
Conversions should represent meaningful business outcomes, not engagement metrics.
Attribution and UTM parameters
GA4 tracks where users come from, but you need to help:
UTM parameters
Add to campaign URLs:
https://yoursite.com/page?utm_source=linkedin&utm_medium=social&utm_campaign=spring_2026
- utm_source: Where the traffic comes from (google, newsletter, linkedin)
- utm_medium: How it got there (cpc, email, social)
- utm_campaign: Which campaign (spring_sale, product_launch)
Attribution models
GA4 defaults to data-driven attribution, which distributes credit across touchpoints. But understand what you’re measuring:
- Last click: All credit to the final touchpoint
- First click: All credit to the first touchpoint
- Linear: Equal credit to all touchpoints
- Data-driven: Machine learning allocates credit
No model is “correct.” Each tells a different story.
Debugging common issues
Traffic suddenly dropped
Check:
- Tracking code still on site?
- GTM container published?
- Filters accidentally applied?
- New consent banner blocking?
Traffic doubled
Check:
- Multiple GA4 implementations?
- Duplicate GTM containers?
- Same data stream added twice?
Conversions not tracking
Check:
- Event firing? (GTM Preview mode)
- Event marked as conversion in GA4?
- Conversion linker tag configured?
Privacy and compliance
Modern tracking must balance data needs with privacy:
Implement consent mode
GA4 Consent Mode respects user choices while preserving some measurement:
gtag('consent', 'default', {
analytics_storage: 'denied',
ad_storage: 'denied',
});
// When user consents
gtag('consent', 'update', {
analytics_storage: 'granted',
ad_storage: 'granted',
});
Cookie-less tracking
GA4 can model conversions when consent is denied, using machine learning to fill gaps. Enable consent mode and GA4 handles the rest.
First-party data
Reduce dependence on third-party cookies:
- Server-side tracking
- First-party cookies
- Authenticated user data
Take action
- Check your current setup with our Analytics Tracker Checker
- Verify GTM is installed correctly (both script and noscript)
- Confirm only one GA4 property is firing
- Set up conversion events for your key goals
- Implement consent mode for compliance
For help with analytics implementation or auditing your current setup, reach out.
Need help shipping?
We help teams build and ship software that works. Performance, SEO, features, weekly demos, full ownership.
Get a Free Audit