npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@olopad/ngx-consent

v0.0.4

Published

Angular GDPR cookie consent with Google Tag Manager & Consent Mode v2

Downloads

60

Readme

@olopad/ngx-consent

A self-contained, GDPR-compliant cookie consent solution for Angular applications with Google Tag Manager (GTM) and Google Consent Mode v2 integration.

Features

  • Google Consent Mode v2 — Sets consent defaults to denied before GTM loads, then updates based on user choice
  • Dynamic GTM injection — No manual <script> tags needed in index.html
  • Cookie banner UI — Slide-up glass-effect banner with Accept All / Reject All / Customize options
  • Configurable categories — Essential (always on), Analytics, Marketing, or custom
  • Branding — Optional logo image in the banner
  • SSR-safe — All browser APIs guarded with isPlatformBrowser
  • Persistent — User choices saved to localStorage and restored on next visit
  • Themeable — OloPad dark theme by default, fully customizable via CSS custom properties

Installation

npm install @olopad/ngx-consent

Quick Start

1. Add provideConsent() to your app config

import { provideConsent } from '@olopad/ngx-consent';

export const appConfig: ApplicationConfig = {
  providers: [
    provideConsent({
      gtmId: 'GTM-XXXXXXX',
      privacyPolicyUrl: '/privacy',
      branding: {
        logoUrl: '/img/logo.svg',
        logoAlt: 'My App',
      },
    }),
  ],
};

2. Add the banner component to your app template

import { ConsentBannerComponent } from '@olopad/ngx-consent';

@Component({
  imports: [ConsentBannerComponent],
  template: `
    <!-- your app content -->
    <olopad-consent-banner />
  `,
})
export class App {}

3. (Optional) Add a "Cookie Settings" link

import { ConsentService } from '@olopad/ngx-consent';

export class FooterComponent {
  private readonly consent = inject(ConsentService);

  onCookieSettings(): void {
    this.consent.showBanner();
  }
}

Configuration

| Property | Type | Required | Description | |---|---|---|---| | gtmId | string | ✅ | Google Tag Manager container ID (e.g. 'GTM-XXXXXXX') | | privacyPolicyUrl | string | ✅ | URL shown as a link in the consent banner | | branding.logoUrl | string | ❌ | Logo image URL displayed in the banner header | | branding.logoAlt | string | ❌ | Alt text for the logo image | | categories | ConsentCategory[] | ❌ | Custom consent categories (defaults provided) |

Default Categories

| Category | Key | Google Consent Types | Required | |---|---|---|---| | Essential | essential | functionality_storage, security_storage | ✅ Always on | | Analytics | analytics | analytics_storage | ❌ | | Marketing | marketing | ad_storage, ad_user_data, ad_personalization | ❌ |

Theming

The banner ships with the OloPad dark theme by default. Override any of these CSS custom properties on the olopad-consent-banner element or a parent:

| Variable | Default | Description | |---|---|---| | --olopad-consent-primary | #00FFCC | Primary accent color | | --olopad-consent-primary-light | #66FFE0 | Primary hover color | | --olopad-consent-bg | #0A0A0F | Banner background | | --olopad-consent-bg-secondary | rgba(255,255,255,0.02) | Card/item background | | --olopad-consent-text | #E8E8ED | Primary text color | | --olopad-consent-text-secondary | #A0A0B0 | Secondary text color | | --olopad-consent-text-muted | #707080 | Muted/description text | | --olopad-consent-border | #2A2A35 | Border color | | --olopad-consent-border-hover | #3A3A48 | Border hover color | | --olopad-consent-surface | #1E1E28 | Toggle background | | --olopad-consent-font-heading | system-ui, sans-serif | Heading font family | | --olopad-consent-radius | 20px | Banner border radius |

Example: Light theme override

olopad-consent-banner {
  --olopad-consent-primary: #0066CC;
  --olopad-consent-bg: #FFFFFF;
  --olopad-consent-text: #1A1A2E;
  --olopad-consent-border: #E0E0E0;
}

ConsentService API

| Method | Description | |---|---| | initialize() | Sets up consent defaults, checks localStorage, injects GTM. Called automatically via APP_INITIALIZER | | acceptAll() | Grants all categories and hides the banner | | rejectAll() | Denies all optional categories (essential stays granted) and hides the banner | | savePreferences(choices) | Saves custom choices from the customize view | | getConsent(key) | Returns 'granted' or 'denied' for a category key | | showBanner() | Shows the consent banner (e.g. from a "Cookie Settings" link) | | hideBanner() | Hides the consent banner |

| Signal | Description | |---|---| | bannerVisible | Whether the banner is currently shown | | hasConsented | Whether the user has made any consent choice |

GTM Setup

See @olopad/consent-setup for an automated CLI tool that sets up GTM + GA4 with Consent Mode v2.