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:
test
2026-09-20 14:49:34 +02:00
parent 37100ced3f
commit 17df4d0ad7
8 changed files with 135 additions and 8 deletions
+16
View File
@@ -64,6 +64,22 @@ it('authenticated home page sends private cache headers', function () {
->toContain('no-store');
});
it('authenticated home page does not render ads', function () {
$user = User::factory()->create();
$this->actingAs($user)
->get('/')
->assertOk()
->assertDontSee('data-ad-slot="8766048277"', false)
->assertDontSee('pagead2.googlesyndication.com', false);
});
it('guest home page renders the dashboard horizontal ad', function () {
$this->get('/')
->assertOk()
->assertSee('data-ad-slot="8766048277"', false);
});
it('home page includes a canonical link tag', function () {
$this->get('/')
->assertStatus(200)