Releases: ArtisanPack-UI/analytics-google
Releases · ArtisanPack-UI/analytics-google
Release list
v1.0.0
Immutable
release. Only release title and notes can be modified.
Initial release of the Google Analytics 4 (GA4) integration for the ArtisanPack UI ecosystem. Ships two independent surfaces — client-side gtag.js tracking and server-side GA4 Data API reporting — either of which can be adopted on its own.
Added
- Client-side GA4 tracking —
@ga4SnippetBlade directive plus React (<Ga4Snippet />) and Vue equivalents emit the standardgtag.jssnippet with escaped measurement IDs and safe defaults. Emits nothing whentracking.measurement_idis empty, so it's safe to leave in a shared layout across environments. - Consent-aware tracking — when installed alongside
artisanpack-ui/analytics, the package registers itself as thegoogle-ga4provider and deferspage_viewevents until the parent's consent banner grants theanalyticscategory. Toggled viatracking.respect_consent; when the parent is absent, tracking fires immediately with no consent gate. - Server-side GA4 Data API client —
Ga4DataClient::runReport()POSTs to the GA4 Data API with typedReportRequest/ReportResponseDTOs,DateRangehelper (with a 730-dayMAX_DAYSclamp), transparent OAuth via the base package'sTokenManager, and a configurable response cache keyed onsha256(property | connection identity | payload). - GA overview surface —
<livewire:analytics-google::ga-overview />plus React and Vue components render sessions, users, page views, and average engagement time for a configurable date range, backed byGaOverviewFetcherand the/analytics-google/overviewHTTP endpoint. - Top pages + top events surface —
<livewire:analytics-google::ga-top-content />plus React and Vue equivalents render top pages (by page views) and top events (by count) viaGaTopContentFetcherand the/analytics-google/top-contentHTTP endpoint. Limit clamped to1..100, default10. - CMS framework admin widgets —
analytics-google-overviewandanalytics-google-top-contentregister automatically whenartisanpack-ui/cms-frameworkis installed, both guarded behind theview_analyticscapability. - Scope registration — contributes
analytics.readonlyto theartisanpack-ui/googlescope registry via theap.google.scopesfilter hook, so consent flows include the GA4 read scope automatically. - Graceful degradation without the base — the service provider boots regardless of whether
artisanpack-ui/googleis installed.Ga4DataClient::isAvailable()returnsfalsewhen the base is missing,runReport()throws a well-typedBaseNotInstalledExceptioninstead of a class-not-found fatal, reporting components render an "install the base" prompt, and HTTP endpoints return501 base_not_installed. GoogleConnectionResolver— shared singleton for looking up the current user's connection; rebind it to override behavior for both Livewire components and both HTTP controllers uniformly (useful for multi-tenant apps).- HTTP error contract — controllers return
401 unauthenticated,409 not_connected,501 base_not_installed(with abaseInstalled: falseflag), and502 reporting_error, all consumed by the React/Vue components' error-code branch. - Comprehensive documentation — full
docs/tree covering installation, client-side tracking, server-side reporting, components, HTTP endpoints, analytics-parent integration, and a complete API reference. - Laravel 10, 11, 12, and 13 support — CI matrix runs PHP 8.2 / 8.3 / 8.4 against Laravel 12 and 13.