C15T Logo

GA4 + Google Ads (gtag.js)

Send data to Google Analytics 4 and Google Ads with automatic Consent Mode v2 support.

Google Tag (gtag.js) is Google's unified tracking script for sending data to Google Analytics 4 (GA4), Google Ads, and Floodlight. It measures user behavior, tracks conversions, and powers Google's advertising ecosystem.

c15t initializes Google Tag with Consent Mode v2 defaults set to denied and automatically updates the consent state when users make choices. You don't need to configure Google Consent Mode yourself.

Choosing the right category:

  • Use category: 'measurement' for analytics-only tracking (GA4 events)
  • Use category: 'marketing' for advertising and conversion tracking (Google Ads)

Adding GA4 + Google Ads to c15t

import { configureConsentManager } from 'c15t';
import { gtag } from '@c15t/scripts/google-tag';

configureConsentManager({
  scripts: [
    gtag({
      id: 'G-XXXXXXXXXX',
      category: 'measurement', // or 'marketing'
    }),
  ],
});

Types

GtagOptions

Property
Types

Script

Property
Types