---
title: "Add Google Analytics · Galley"
description: "Count visits with Google Analytics 4, loaded only once visitors agree to it."
canonical: "https://galleycms.com/how-to/add-analytics/"
language: "en"
---

# Add Google Analytics

Count visits with Google Analytics 4, loaded only once visitors agree to it.

1. Open **Scripts** in the sidebar and press **Add a script**, then choose **Google Analytics 4**.

   ![The Scripts screen with the Add a script window open: Google Tag Manager, Google Analytics 4, Plausible, Segment, Hotjar, Microsoft Clarity, Meta Pixel and more, each with a line about what it does.](https://galleycms.com/howto/add-analytics-1.webp)
2. Paste your **Measurement ID** (it looks like G-XXXXXXXXXX) and press **Add Google Analytics 4**.

   You’ll see: **Already chosen for you** says when and where it loads, and that it waits for the visitor's consent to analytics.

   ![The Add Google Analytics 4 window with the measurement ID G-7K2M4Q9XRB filled in, and under Already chosen for you: straight away, in the page head, consent: Analytics, every page.](https://galleycms.com/howto/add-analytics-2.webp)
3. Check it under **Installed**: it's switched on, and its **Consent** is **Analytics**. Under **Consent**, **Ask visitors first** is **Built-in banner**, so it loads only after a visitor agrees.

   ![Google Analytics 4 under Installed, switched on and marked New, with Every page, Straight away and Consent: Analytics chosen; beside it the Consent panel with Ask visitors first set to Built-in banner.](https://galleycms.com/howto/add-analytics-3.webp)
4. Open **Proof** to see the change waiting, then press **Publish**.

   You’ll see: Nothing loads on the live site until you publish.

   ![Proof with 1 change waiting to be published: Scripts, src/data/scripts.json, Edited — Added a script; under What changed, Scripts › Google Analytics 4, Added, with Put back.](https://galleycms.com/howto/add-analytics-4.webp)

Every detail, and what to do if something’s different: [The full guide: Add Google Analytics](https://galleycms.com/docs/editing/scripts/)

[All how-to guides](https://galleycms.com/how-to/)
