Download the PHP package malzariey/filament-ga4-analytics without Composer
On this page you can find all versions of the php package malzariey/filament-ga4-analytics. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download malzariey/filament-ga4-analytics
More information about malzariey/filament-ga4-analytics
Files in malzariey/filament-ga4-analytics
Package filament-ga4-analytics
Short Description A Google Analytics 4 reports page for Filament panels: live visitors, KPIs, funnel, events, breakdowns and traffic sources, read through the GA4 Data API with a read-only service account.
License MIT
Homepage https://github.com/malzariey/filament-ga4-analytics
Informations about the package filament-ga4-analytics
Filament GA4 Analytics
A Google Analytics 4 reports page for Filament 5 panels, read through the GA4 Data API with a read-only service account:
- Live — active visitors now, a 30-minute per-minute chart, pages, devices and countries on screen (polled, from a cache shared by everyone watching).
- Headline figures — visitors, new visitors, sessions, views, engagement,
average session, key events (or purchases/revenue) for today, 7, 30 or 90
days, or any range from
malzariey/filament-daterangepicker-filter(week starts Saturday by default). - Trend — visitors per day (per hour for a single day), gaps filled.
- Funnel and events — your own event names, labels and drill-down links.
- Breakdowns — any dimension/metric pair; pages, devices, countries and cities by default.
- Traffic sources and an optional staff tab for a second property.
Arabic-first (ar, en shipped), RTL-correct, Western digits in both locales,
light and dark mode, and no Tailwind utilities — it works in a panel with or
without a custom theme.
Install
Without resolvers the page falls back to GA4_PROPERTY_ID and
GA4_CREDENTIALS_PATH. Code outside the panel can register the same resolvers on
Malzariey\FilamentGa4Analytics\Support\Ga4Connection.
Google side
- Enable the Google Analytics Data API in the service account's Cloud project.
- In GA, Admin → Property access management, add the service account e-mail as Viewer.
- Put its JSON key outside the web root, readable only by the site user (0600).
The property id is the numeric id, not the
G-XXXXXXXXXXmeasurement id.
Configure the reports
Live lists link through linkUsing() as live:<key> (dated today); staff
events as staff_event:<name>. A live list whose own request GA refuses (other
than for quota) falls back to its fallbackUsing() closure, or to an empty
list — the rest of the live card stays up.
To reword the page for one host (a funnel heading, a KPI name, an error that
names your own settings page), override only those keys in
lang/vendor/filament-ga4-analytics/{ar,en}/analytics.php — Laravel merges
them over the package's.
Loading behaviour
- Deferred load. The first render is the shell — title, header actions,
range controls — with a skeleton of every card, shaped like the loaded card
(same headings, same reserved row counts), so nothing moves when the data
arrives.
wire:initthen callsloadReports()once; no report runs before it, so the first paint never waits on Google. - Range changes show a thin progress bar at the top of the viewport, dim
the sections being refreshed and disable the range controls
(
Ga4AnalyticsPage::RANGE_TARGETS). - The live poll calls
refreshLive(), which none of the above listens to: it only lights a small «refreshing» marker on the live card. prefers-reduced-motionstops the shimmer and the sliding bar (the bar stays visible, full width).
Caching and quota
Every report is cached and shared by all viewers (report_seconds 300,
realtime_seconds 25, failures error_seconds 60). The Data API meters a daily
token budget per property; the cache is what keeps a busy page inside it. Call
app(AnalyticsReports::class)->forget() and
app(TokenProvider::class)->forgetAll() when the property or key changes.
Tests
Set GA4_ANALYTICS_DRIVER=fake in phpunit.xml. The fake answers deterministic
rows and refuses to run in production; an unknown driver name throws rather
than falling back to it.
Publishing
License
MIT
All versions of filament-ga4-analytics with dependencies
filament/filament Version ^5.0
illuminate/contracts Version ^12.0|^13.0
malzariey/filament-daterangepicker-filter Version ^5.0.7
spatie/laravel-package-tools Version ^1.16.4