{">

Google Analytics 4 Setup & AdSense Integration

Car Dashboard Warning Lights Explained

GA4 Property Creation

Step 1: Create GA4 Property

Step 2: Data Stream Configuration

Web Data Stream: Enhanced Measurement Events:

Event Tracking Configuration

Standard Events (Automatic)

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

- Values: red, yellow, blue, green, specific light names - Values: hub, specific_light, faq, glossary - Values: informational, diagnostic, purchase

Custom Metrics

- Type: Integer - Type: Time

AdSense Integration

AdSense Account Setup

Ad Unit Configuration

Display Ads: In-Article Ads: In-Feed Ads:

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

- Organic search

- Direct

- Social

- Referral

- Average session duration

- Pages per session

- Bounce rate

- Scroll depth

- Page RPM

- Click-through rate

- Total revenue

- Top performing pages

Custom Reports

Report 1: Warning Light Performance Report 2: User Journey Report 3: Content Performance

Implementation Checklist