From c42474cc1f3010e20696034ec6efd549bec0a9d4 Mon Sep 17 00:00:00 2001 From: "Sebastian BURGIN-FIX (ext)" Date: Sun, 25 Oct 2026 02:59:40 +0200 Subject: [PATCH] fix(analytics): track zunscan.codebar.ch and load the tracker without credentials zunscan.codebar.ch has its own layout without Fathom, so the tracker was missing there; it now includes the codebar analytics partial too. crossorigin="anonymous" fetches script.js without credentials, so the browser ignores Cloudflare's __cf_bm cookie on analytics.codebar.ch instead of storing it as a third-party cookie. Co-Authored-By: Claude Opus 5.5 --- resources/views/components/zunscan/layout.blade.php | 2 ++ .../layouts/_partials/_codebar_analytics.blade.php | 2 +- tests/Feature/Views/CodebarAnalyticsPartialTest.php | 12 +++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/resources/views/components/zunscan/layout.blade.php b/resources/views/components/zunscan/layout.blade.php index 7982e55..9f43a7b 100644 --- a/resources/views/components/zunscan/layout.blade.php +++ b/resources/views/components/zunscan/layout.blade.php @@ -80,5 +80,7 @@ {{ $slot }} + +@include('layouts._partials._codebar_analytics') diff --git a/resources/views/layouts/_partials/_codebar_analytics.blade.php b/resources/views/layouts/_partials/_codebar_analytics.blade.php index 4c38286..3ba6edf 100644 --- a/resources/views/layouts/_partials/_codebar_analytics.blade.php +++ b/resources/views/layouts/_partials/_codebar_analytics.blade.php @@ -4,5 +4,5 @@ @endphp @if (in_array(app()->environment(), $environments) && $url) - + @endif diff --git a/tests/Feature/Views/CodebarAnalyticsPartialTest.php b/tests/Feature/Views/CodebarAnalyticsPartialTest.php index c463077..d796adb 100644 --- a/tests/Feature/Views/CodebarAnalyticsPartialTest.php +++ b/tests/Feature/Views/CodebarAnalyticsPartialTest.php @@ -9,7 +9,7 @@ app()['env'] = 'production'; expect(view('layouts._partials._codebar_analytics')->render()) - ->toContain(''); + ->toContain(''); })->group('analytics'); it('does not embed the codebar analytics script outside production', function () { @@ -24,3 +24,13 @@ expect(view('layouts._partials._codebar_analytics')->render())->not->toContain('group('analytics'); + +it('embeds the codebar analytics script on zunscan.codebar.ch in production', function () { + $this->withoutVite(); + Config::set('default.services.codebar_analytics.url', 'https://analytics.codebar.ch'); + app()->detectEnvironment(fn () => 'production'); + + $this->get('http://zunscan.codebar.ch/de-ch') + ->assertOk() + ->assertSee('', false); +})->group('analytics');