ngx-gtag
An Angular library for integrating Google Tag Manager and GA4, with SSR support.

| Type | Open-source library |
|---|---|
| Year | 2022 |
| Where | Published under @bloomscorp on npm |
| Role | Author |
| Stack | Angular, TypeScript |
| Outcome | Runs in production across Bloomscorp projects. |
Overview
A lightweight, configurable Angular wrapper for Google Analytics 4 (GA4), designed to simplify event tracking and page-view logging in Angular applications without relying on the global gtag object everywhere.
My contribution
- Ideated, architected, and built the library from scratch following Angular packaging and TypeScript best practices.
- Designed a flexible API that integrates GA4 tracking in minutes with minimal setup.
- Implemented core services that abstract Google Analytics logic away from components.
- Added multiple tracking-ID support for enterprise multi-tenant needs.
- Ensured compatibility with Angular’s DI and build systems for performance and maintainability.
- Published and maintain the library on npm under the Bloomscorp scope.
- Wrote documentation with usage guides, installation steps, and troubleshooting tips.
- Used in production across Bloomscorp projects to track user interactions and business metrics.
Key features
- Plug-and-play GA4 integration for Angular apps.
- Automatic and manual page-view tracking.
- A simple API to log custom events with categories, actions, and labels.
- Environment-based enable/disable for development and production.
- Multiple tracking IDs, for multi-tenant or multi-brand apps.
- Service-based abstraction, so components never use gtag directly.
- Tree-shakable and compatible with Angular’s dependency injection.
- Detailed documentation and usage examples on npm.
