// Analytics Setup
Step-by-step instructions for Mr. Burns to connect Google Analytics to creaturesincrisis.org. Takes about 10 minutes.
If you don't already have a Google Analytics account set up for creaturesincrisis.org, create one now. If you have one, skip to Step 3.
https://creaturesincrisis.orgOnce your property is created, Google Analytics will show you a Data Stream. From there you get your Measurement ID:
G-XXXXXXXXXXYour ID starts with G- followed by 10 alphanumeric characters. Example: G-M3HX8K2P7Q. Copy it exactly — no extra spaces.
The GA4 tracking code is already installed site-wide. You just need to replace G-MEASUREMENT_ID with your real ID.
Find and replace G-MEASUREMENT_ID in all these files:
Regenerate species pages after editing species_template_v2.html to apply to all species pages.
This is the exact GA4 script injected into every page (inside the <head>, before any other scripts):
This uses the gtag.js approach — the official Google Analytics 4 tagging method. It loads asynchronously so it won't slow down your pages.
After replacing the placeholder ID and deploying:
If you have an ad blocker extension, disable it temporarily when testing — many blockers also block Google Analytics tracking.
With this integration, Google Analytics will automatically collect:
Custom events (like quiz completions and pledge submissions) can be added to GA4 by calling gtag('event', 'event_name', { ... }) in JavaScript.
You don't need to touch these — they're already configured. The GA4 script placeholder is present in all major pages. When you swap in your real Measurement ID, data collection begins immediately across the entire site.