[object Object]

← back to Beverlyhillsvideos App

BHV: add App Tracking Transparency before tracking WebView (Guideline 5.1.2 Path A)

a507e3ea68a2ad04af89994999e2b2d4368a8501 · 2026-09-03 13:02:56 -0700 · Steve

The beverlyhillsvideos.com WebView runs GA4 + GTM + Facebook Pixel + AdSense
(kept for ad revenue). Adds expo-tracking-transparency, fires
requestTrackingPermissionsAsync() on first launch and holds the tabs (tracking
WebView) render until it resolves, so the ATT prompt is answered before any
cross-site tracking request fires. Adds NSUserTrackingUsageDescription +
config plugin string.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YNivxV68DdxP1rvhViBfcN

Files touched

Diff

commit a507e3ea68a2ad04af89994999e2b2d4368a8501
Author: Steve <steve@designerwallcoverings.com>
Date:   Thu Sep 3 13:02:56 2026 -0700

    BHV: add App Tracking Transparency before tracking WebView (Guideline 5.1.2 Path A)
    
    The beverlyhillsvideos.com WebView runs GA4 + GTM + Facebook Pixel + AdSense
    (kept for ad revenue). Adds expo-tracking-transparency, fires
    requestTrackingPermissionsAsync() on first launch and holds the tabs (tracking
    WebView) render until it resolves, so the ATT prompt is answered before any
    cross-site tracking request fires. Adds NSUserTrackingUsageDescription +
    config plugin string.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01YNivxV68DdxP1rvhViBfcN
---
 app.json        |  7 +++++++
 app/_layout.tsx | 23 +++++++++++++++++++----
 package.json    |  1 +
 3 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/app.json b/app.json
index e3c2613..34ac67a 100644
--- a/app.json
+++ b/app.json
@@ -14,6 +14,7 @@
       "bundleIdentifier": "com.abrams.beverlyhillsvideos",
       "infoPlist": {
         "NSLocationWhenInUseUsageDescription": "Show nearby Beverly Hills restaurants on the map.",
+        "NSUserTrackingUsageDescription": "This lets us measure content performance and show more relevant ads on beverlyhillsvideos.com.",
         "NSAppTransportSecurity": {
           "NSAllowsArbitraryLoads": true
         },
@@ -40,6 +41,12 @@
     "plugins": [
       "expo-router",
       "expo-font",
+      [
+        "expo-tracking-transparency",
+        {
+          "userTrackingPermission": "This lets us measure content performance and show more relevant ads on beverlyhillsvideos.com."
+        }
+      ],
       [
         "expo-splash-screen",
         {
diff --git a/app/_layout.tsx b/app/_layout.tsx
index 0475d03..18719a3 100644
--- a/app/_layout.tsx
+++ b/app/_layout.tsx
@@ -1,17 +1,32 @@
-import { useEffect } from 'react';
+import { useEffect, useState } from 'react';
 import { Stack } from 'expo-router';
 import { StatusBar } from 'expo-status-bar';
 import * as SplashScreen from 'expo-splash-screen';
-import { Colors } from '@/constants/Colors';
+import { requestTrackingPermissionsAsync } from 'expo-tracking-transparency';
 
 SplashScreen.preventAutoHideAsync();
 
 export default function RootLayout() {
+  // Hold the tracking WebView (tabs) until App Tracking Transparency resolves,
+  // so the ATT prompt is answered BEFORE any GA4/GTM/Facebook Pixel/AdSense
+  // request can fire (Guideline 5.1.2 — cross-site tracking requires ATT).
+  const [attResolved, setAttResolved] = useState(false);
+
   useEffect(() => {
-    // Hide splash after fonts/assets would load here
-    SplashScreen.hideAsync();
+    (async () => {
+      try {
+        await requestTrackingPermissionsAsync();
+      } catch {
+        // proceed regardless — ATT is best-effort, never blocks the app
+      } finally {
+        setAttResolved(true);
+        SplashScreen.hideAsync();
+      }
+    })();
   }, []);
 
+  if (!attResolved) return null;
+
   return (
     <>
       <StatusBar style="dark" />
diff --git a/package.json b/package.json
index 81e477e..a1de3ef 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
     "expo-router": "~57.0.11",
     "expo-splash-screen": "~57.0.5",
     "expo-status-bar": "~57.0.1",
+    "expo-tracking-transparency": "~57.0.1",
     "react": "19.2.3",
     "react-native": "0.86.2",
     "react-native-maps": "1.27.2",

← 769a396 app: add iPad Pro 12.9 screenshot generator + 5 captures (20  ·  back to Beverlyhillsvideos App  ·  auto-data-snapshot: 2026-09-04T14:52:10 (1 data files) — pac a1601d0 →