All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
<perpetuum-analytics /> logo in the brand colours, in light and dark.perpetuum-analytics, by the same author.start: 'manual', and that the provider starts on its own only without it.Our best version so far: SSR-safe by design, Google Tag Manager without a snippet, Consent Mode, and every release proven by 100 % test coverage and an end-to-end test of a real SSR app. Everything 2.x did for GA4 and Tag Manager is still here, including a manual start and the 2.x data layer names. The package is now @triliumhr/perpetuum-analytics, under the MIT licence.
2.x (perpetuum-analytics) gets security fixes only, until 30 April 2027: no new features and no new Angular versions.
Step-by-step guide: Moving from 2.x.
npm i @triliumhr/perpetuum-analytics instead of perpetuum-analytics.AnalyticsModule.forRoot() is replaced by provideAnalytics({ tag: 'gtag', measurementId }) or provideAnalytics({ tag: 'gtm', containerId }).setGoogleAnalyticsScripts() is gone: the provider starts on its own in the browser. Apps that called it only after consent use start: 'manual' and analytics.start().AnalyticsService.sendEvent({ eventCategory, eventAction, eventLabel, eventValue }) is replaced by Analytics.event(name, params) with GA4 names and parameters.[perpetuumAnalytics] directive is replaced by perpetuumTrack with [perpetuumTrackParams].trackingType: 'analytics') is no longer supported, since Google retired Universal Analytics.@angular/router and rxjs are peer dependencies.index.html; the package loads the container.page_view with page_location and page_title (was pageview with page.path and page.title), and events carry their own name instead of GAEvent. legacyEventNames: true keeps the 2.x names, so an existing container counts without changes; or update its triggers and variables, see Moving from 2.x.provideAnalytics() for Google Analytics 4 and Google Tag Manager: the tag loads once when the app starts in the browser, with one page view per navigation.Analytics.event(name, params) and the perpetuumTrack directive for custom events, also in apps without the router.consentDefaults, sent before any other command, and Analytics.updateConsent().start: 'manual' and Analytics.start(): nothing loads from Google until the app starts the tag, for example once the visitor agrees, as setGoogleAnalyticsScripts() allowed in 2.x. A late start counts the current page, and a consent choice made before it follows the defaults. (#44)legacyEventNames: true for Google Tag Manager: page views as pageview with page.path and page.title, and events as GAEvent with eventCategory, eventAction, eventLabel and eventValue, as 2.x pushed them.CSP_NONCE (or ngCspNonce on the root element), so a strict nonce-based Content Security Policy needs no Google host in script-src. Without a nonce nothing changes. (#42)@angular/platform-server, and an end-to-end test runs a demo app with Angular SSR in Chromium.event can no longer turn one event into another.AnalyticsModule, AnalyticsService, the perpetuumAnalytics directive and the I* config types.setGoogleAnalyticsScripts() no longer needs a Renderer2; the argument is accepted and ignored.ERROR in node_modules/perpetuum-analytics/lib/analytics.module.d.ts(2,34): error TS2307: Cannot find module '@projects/perpetuum-analytics/src/lib/models/Analytics-config.model'.
Test builds