Keep AdSense rendering limited to anonymous visitors.
Show guest-only ad units on public pages and skip the AdSense script entirely for signed-in users.
This commit is contained in:
@@ -261,8 +261,8 @@
|
||||
@inertiaHead
|
||||
@endif
|
||||
|
||||
@if(config('services.google_adsense.publisher_id'))
|
||||
{{-- Google AdSense — consent-gated loader --}}
|
||||
@if(auth()->guest() && config('services.google_adsense.publisher_id'))
|
||||
{{-- Google AdSense — guests only, consent-gated loader --}}
|
||||
{{-- Script is only injected after the user accepts all cookies. --}}
|
||||
{{-- If consent was given on a previous visit it fires on page load. --}}
|
||||
<script>
|
||||
@@ -297,6 +297,10 @@
|
||||
})();
|
||||
</script>
|
||||
@endif
|
||||
@guest
|
||||
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6457864535683080" crossorigin="anonymous"></script>
|
||||
@endguest
|
||||
|
||||
</head>
|
||||
@php
|
||||
$authBgRoutes = [
|
||||
|
||||
Reference in New Issue
Block a user