Skip to content

Commit a14a987

Browse files
committed
fix: address PR review feedback for Google Consent Mode v2 implementation
1 parent 1d131e4 commit a14a987

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

apps/web-roo-code/src/components/providers/google-analytics-provider.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@ export function GoogleAnalyticsProvider({ children }: { children: React.ReactNod
3131
personalization_storage: "denied",
3232
security_storage: "granted", // Always granted for security
3333
wait_for_update: 2000, // Wait up to 2 seconds for consent update
34+
// Enable cookieless pings for conversion measurement
35+
url_passthrough: true, // Pass click information via URL parameters
36+
ads_data_redaction: true, // Redact ads data when consent is denied
3437
})
3538

36-
// Enable cookieless pings for conversion measurement
37-
// These must be set separately with gtag 'set' command
38-
window.gtag("set", "ads_data_redaction", true) // Redact ads data when consent is denied
39-
window.gtag("set", "url_passthrough", true) // Pass click information via URL parameters
40-
4139
// Check initial consent status and update if already consented
4240
if (hasConsent()) {
4341
updateConsentState(true)
@@ -84,10 +82,12 @@ export function GoogleAnalyticsProvider({ children }: { children: React.ReactNod
8482
/>
8583
<Script id="google-ads-config" strategy="afterInteractive">
8684
{`
85+
gtag('js', new Date());
86+
8787
// Configure Google Ads with enhanced measurement
8888
gtag('config', '${GADS_ID}', {
89-
allow_google_signals: false, // Disable by default, enabled when consent granted
90-
allow_ad_personalization_signals: false, // Disable by default
89+
allow_google_signals: false,
90+
allow_ad_personalization_signals: false,
9191
// Enable enhanced conversions for better measurement
9292
enhanced_conversions: {
9393
automatic: true

apps/web-roo-code/src/lib/analytics/google-ads.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,3 @@ export function trackPageViewForRemarketing() {
4343
})
4444
}
4545
}
46-
47-
/**
48-
* Initialize enhanced conversions for better measurement
49-
* This should be called once when the app initializes
50-
*/
51-
export function initializeEnhancedConversions() {
52-
if (typeof window !== "undefined" && window.gtag) {
53-
// Enable enhanced conversions for better measurement accuracy
54-
// This works with Consent Mode v2 to provide better conversion modeling
55-
window.gtag("set", "user_data", {
56-
// User data will only be sent if consent is granted
57-
// Otherwise, Google uses conversion modeling
58-
})
59-
}
60-
}

0 commit comments

Comments
 (0)