Google Analytics 4 Setup & AdSense Integration
Car Dashboard Warning Lights Explained
GA4 Property Creation
Step 1: Create GA4 Property
- Go to Google Analytics > Admin
- Click "Create Property"
- Enter property name: "Car Dashboard Warnings"
- Select timezone and currency
- Click "Create"
Step 2: Data Stream Configuration
Web Data Stream:- Website URL: https://cardashboardwarnings.com
- Stream name: "Website"
- Enhanced measurement: Enabled
- Page views: ✅ Enabled
- Scrolls: ✅ Enabled (25%, 50%, 75%, 100%)
- Outbound clicks: ✅ Enabled
- Site search: ✅ Enabled
- Video engagement: ✅ Enabled
- File downloads: ✅ Enabled
Event Tracking Configuration
Standard Events (Automatic)
- page_view
- session_start
- first_visit
Custom Events (Manual Implementation)
Scroll Depth Tracking
// Track scroll depth at 25%, 50%, 75%, 100%
gtag('event', 'scroll_depth', {
'scroll_percentage': 25,
'page_location': window.location.href,
'page_title': document.title
});
Outbound Click Tracking
// Track clicks on external links
document.querySelectorAll('a[href^="http"]').forEach(link => {
link.addEventListener('click', function(e) {
gtag('event', 'outbound_click', {
'link_url': this.href,
'link_text': this.textContent,
'page_location': window.location.href
});
});
});
AdSense Revenue Attribution
// Track AdSense impressions and clicks
window.adsbygoogle = window.adsbygoogle || [];
window.adsbygoogle.push({
'onload': function() {
// Track ad impressions
gtag('event', 'ad_impression', {
'ad_unit': this.adUnit,
'page_location': window.location.href
});
}
});
// Track ad clicks
document.querySelectorAll('.adsbygoogle').forEach(ad => {
ad.addEventListener('click', function() {
gtag('event', 'ad_click', {
'ad_unit': this.dataset.adUnit,
'page_location': window.location.href
});
});
});
Custom Dimensions & Metrics
Custom Dimensions
- warning_light_type (Scope: Event)
- page_category (Scope: Event)
- user_intent (Scope: User)
Custom Metrics
- scroll_depth_percentage (Scope: Event)
- time_on_page (Scope: Event)
AdSense Integration
AdSense Account Setup
- Create AdSense account (if not existing)
- Verify website ownership
- Create ad units for each page type
Ad Unit Configuration
Display Ads:- Leaderboard (728x90) - Header
- Rectangle (300x250) - Sidebar
- Large Rectangle (336x280) - Content
- Responsive in-article ads
- Placed after every 3-4 paragraphs
- Responsive in-feed ads
- Placed in article lists
Revenue Attribution Setup
// Track AdSense revenue in GA4
gtag('config', 'GA_MEASUREMENT_ID', {
'custom_map': {
'dimension1': 'warning_light_type',
'dimension2': 'page_category'
}
});
// Enhanced AdSense tracking
gtag('event', 'ad_click', {
'ad_unit': 'dashboard-banner',
'revenue': 0.05, // Example CPC
'currency': 'USD'
});
Dashboard & Reporting
Key Metrics to Track
- Traffic Sources
- Direct
- Social
- Referral
- User Behavior
- Pages per session
- Bounce rate
- Scroll depth
- AdSense Performance
- Click-through rate
- Total revenue
- Top performing pages
Custom Reports
Report 1: Warning Light Performance- Dimension: warning_light_type
- Metrics: Sessions, Page RPM, Revenue
- Dimension: Page path
- Metrics: Entrances, Exits, Time on page
- Dimension: Page title
- Metrics: Page views, Average time, Revenue
Implementation Checklist
- [ ] Create GA4 property
- [ ] Set up web data stream
- [ ] Enable enhanced measurement
- [ ] Implement custom events
- [ ] Configure custom dimensions
- [ ] Set up AdSense integration
- [ ] Create custom reports
- [ ] Set up conversion tracking
- [ ] Configure data retention settings
- [ ] Enable Google Signals