@olopad/consent-setup
v0.0.7
Published
CLI tool to automate GTM + GA4 setup with Google Consent Mode v2
Readme
@olopad/consent-setup
CLI tool to automate the Google Tag Manager + GA4 setup with Google Consent Mode v2.
Use this alongside @olopad/ngx-consent to get a complete GDPR-compliant analytics setup.
Usage
npx @olopad/consent-setupOr install globally:
npm install -g @olopad/consent-setup
consent-setupPrerequisites
A Google Cloud project with these APIs enabled:
OAuth2 credentials (Desktop app type):
- Go to APIs & Services → Credentials
- Click Create Credentials → OAuth client ID → Desktop app
- Download the JSON and save it as
client_secret.jsonin your working directory
What it does
- Opens your browser for Google authentication
- Creates (or selects existing) GA4 property + web data stream → Measurement ID
- Creates (or selects existing) GTM container
- Creates a GA4 tag with consent settings (
analytics_storagerequired) - Publishes the GTM container version
- Prints the
gtmIdandmeasurementIdfor your app config
