AI Global Academy Join the waitlist

Courses / Analytics and measurement

Lesson 6.3 · 50 minGoogle Analytics 4

Duration~50 min in the lesson + ~20 min homework
PrerequisitesCheckpoint lesson-6.2
Checkpointlesson-6.3

What you will have

A GA4 property receives page views from the live site through the Tag Manager container, with no analytics code in the project, and the student has seen their own visit in the Realtime report. Four starting settings are in place: time zone and currency, data retention, an internal-traffic rule, and form interactions switched off in enhanced measurement.

Video

The video for this lesson is not recorded yet.

Do along

Work on your own project. Pause the video where a step says so.

  1. Pause after Part 2. Create the GA4 account, property and web data stream for your site. Set your own time zone and currency. Copy the measurement ID.
  2. Pause after Part 3. In Tag Manager create the Constant variable GA4 measurement ID and the tag Google tag – GA4 on the initialization trigger for all pages. Preview on your live site and confirm the tag fires at Initialization.
  3. Pause after Part 4. With preview still connected, watch page_view arrive in DebugView. Publish with a version name.
  4. Open the site in a normal tab and find yourself in Realtime.
  5. Pause after Part 5. Change the four settings: check time zone and currency; retention to 14 months; internal-traffic rule with your IP and the filter left in Testing; form interactions off.
  6. Ask Claude to add a "GA4 settings" section to docs/measurement-plan.md recording the four settings and the reason for each, without writing the measurement ID, the container ID or your IP address into the document, and without changing code.
  7. Commit and tag (commands in "Recap and next").

Check your work

  1. Open the live site in a normal browser tab, then GA4 → Reports → Realtime. Expected: at least one active user within about a minute, and page_view in "Event count by Event name".
  2. In Tag Manager preview, click the Initialization entry. Expected: Google tag – GA4 under Tags Fired, once.
  3. Search the project code for G- followed by your ID, and for gtag. Expected: no matches. GA4 exists only inside the container.
  4. In GA4 Admin, open the data retention setting. Expected: 14 months.
  5. In GA4 Admin → Data filters. Expected: the internal traffic filter exists and its state is Testing.
  6. In the stream's enhanced measurement settings. Expected: Form interactions is off, page views is on.

Common problems

  • Realtime shows nobody. → Usual causes: the container was not published, only saved; an ad blocker is on; you are looking at a different property. → Check the Versions tab in Tag Manager for the new version; test in a clean browser profile; compare the measurement ID in the stream with the Constant variable.
  • DebugView is empty while preview is connected. → The device selector at the top of DebugView is on another device, or the tag did not fire. → Pick your device in the selector; in Tag Assistant confirm the Google tag is under Tags Fired.
  • Two page views for each page load. → GA4 was also added in code, or two Google tags exist in the container. → Ask Claude: "Search the project for any Google Analytics or gtag code outside GTM and remove it; report what you found." Check the container for a duplicate tag.

Homework

About 20 minutes, after the lesson. Nothing here is needed to start 6.4. Leave the internal-traffic filter in Testing and form interactions switched off. Task 3 changes the project: commit and push without a tag.

  1. A second device in Realtime (~5 min). Open your live site on your phone and find that visit in Realtime. In your course notes write three things Realtime tells you about the visit and one thing you wanted to know that it does not show. Done when: Realtime showed the phone visit and the four lines are written.
  2. A second place you work from (~5 min). If you regularly open the site from another connection, such as home and an office, repeat the internal-traffic step from Part 5 there with the same internal value. If you work from one place only, write that down instead. Done when: every connection you regularly work from is defined as internal, and the filter is still in Testing.
  3. The retention period on your privacy page (~10 min). Part 5 said to mention it. Ask Claude: "On /privacy, add one or two plain sentences saying that the site uses Google Analytics and that detailed analytics data is kept for 14 months. Change nothing else. Run the build and load the page before reporting." Read the wording yourself; this is not legal advice. Done when: the live /privacy page states the period.

Save your work

git add -A
git commit -m "Lesson 6.3: GA4 through GTM, settings recorded"
git tag lesson-6.3
git push
git push --tags