๐ฏ GTM Setup Guide
Step-by-Step Guide to Setting Up Google Tag Manager
Current Status
- โ
GTM Container:
GTM-WKCPQZ3G - โ HTML file created with GTM code
- โณ Need to: Create GA4 Configuration Tag
- โณ Need to: Publish container
๐ Step-by-Step: Create Your First Tag
Step 1: Get Your GA4 Measurement ID
- Go to Google Analytics
- Click Admin (gear icon, bottom left)
- Under Property, click Data Streams
- Click on your web stream
- Copy your Measurement ID (format:
G-XXXXXXXXXX)
Don't have GA4 yet?
- Go to Admin โ Create Property โ Web โ Enter site details
- Copy the Measurement ID that's generated
Step 2: Create GA4 Configuration Tag in GTM
- In GTM, click "Add a new tag" (or go to Tags โ New)
- Tag Configuration:
- Click "Tag Configuration"
- Select "Google Analytics: GA4 Configuration"
- Enter Measurement ID:
- Paste your GA4 Measurement ID (e.g.,
G-ABC123XYZ) - Leave other fields as default
- Paste your GA4 Measurement ID (e.g.,
- Set Trigger:
- Click "Triggering" section
- Click the pencil icon
- Select "All Pages" (this fires on every page load)
- Click "Save"
- Name Your Tag:
- At the top, name it:
GA4 - Configuration - Click "Save"
- At the top, name it:
Step 3: Create Click Event Tag
- Create New Tag:
- Click Tags โ New
- Tag Configuration:
- Click "Tag Configuration"
- Select "Google Analytics: GA4 Event"
- Configure Event:
- Configuration Tag: Select your
GA4 - Configurationtag - Event Name:
button_click - Leave other fields as default
- Configuration Tag: Select your
- Set Trigger:
- Click "Triggering" section
- Click the pencil icon โ "New"
- Trigger Type: "Click - All Elements"
- Trigger Name:
Click - Test Button - Under "This trigger fires on": Select "Some Clicks"
- Condition:
- Variable:
Click Element - Condition:
matches CSS selector - Value:
#testButton
- Variable:
- Click "Save"
- Name Your Tag:
- Name:
GA4 - Button Click Event - Click "Save"
- Name:
Step 4: Preview & Test
- Enter Preview Mode:
- Click "Preview" button (top right)
- Enter your localhost URL:
http://localhost/gtm-learning/index.php - Click "Connect"
- Test Your Setup:
- A new browser tab will open
- You'll see GTM Preview panel at the bottom
- Click the "Click Me" button on your page
- In Preview panel, you should see:
- โ
gtm.jsloaded - โ
GA4 - Configurationtag fired - โ
GA4 - Button Click Eventtag fired (when you click)
- โ
- Verify Events:
- In Preview panel, click on each tag
- Check that events are firing correctly
- Look for any errors (red indicators)
Step 5: Publish Your Container
- Submit Changes:
- Click "Submit" button (top right, blue)
- Version Name:
Initial GA4 Setup - Version Description:
Added GA4 Configuration and Button Click Event - Click "Publish"
- Verify:
- The "Workspace Changes: 0" should reset
- Your tags are now live!
Step 6: Verify in GA4
- Open GA4 DebugView:
- Go to Google Analytics
- Navigate to Reports โ DebugView
- (Or Admin โ DebugView)
- Enable Debug Mode:
- Install Tag Assistant Legacy Chrome extension
- OR add
?debug_mode=trueto your URL - OR use Chrome DevTools โ Application โ Cookies โ Add
debug_mode=true
- Test Again:
- Open your learning platform page
- Click the buttons
- You should see events in real-time in DebugView:
page_viewbutton_clickcustom_event
โ Verification Checklist
- GA4 Configuration tag created
- Button Click Event tag created
- Both tags have correct triggers
- Preview mode shows tags firing
- Container published successfully
- Events appear in GA4 DebugView
- Events appear in GA4 Realtime reports
๐ Troubleshooting
"No Recent Data" Warning Still Shows
Solution: This is normal for new containers. It will disappear after:
- You publish your container
- Your page loads with GTM code
- Tags fire successfully
- Wait 24-48 hours for the warning to clear
Tags Not Firing in Preview
- Check that your localhost URL is correct
- Verify GTM code is in your HTML (check Network tab)
- Make sure triggers are configured correctly
- Check browser console for errors
Events Not Appearing in GA4
- Verify Measurement ID is correct
- Check that container is published
- Enable DebugView to see real-time events
- Wait a few minutes for data to process
Preview Mode Not Connecting
- Make sure you're using the exact URL (including
http://orhttps://) - Try refreshing the preview connection
- Check if ad blockers are interfering
๐ What You Should See
In GTM Preview:
โ
gtm.js - Loaded
โ
GA4 - Configuration - Fired
โ
GA4 - Button Click Event - Fired (when button clicked)
In GA4 DebugView:
Event: page_view
Event: button_click
Event: custom_event
In GA4 Realtime:
- Your active session
- Events firing in real-time
- User location and device info
๐ฏ Next Steps
Once basic tracking works:
- Add More Events:
- Scroll tracking
- Form submissions
- Video plays
- Outbound link clicks
- Set Up Conversions:
- Mark important events as conversions in GA4
- Track goals and objectives
- Create Custom Dimensions:
- Track user segments
- Add custom data to events
- Set Up Google Ads:
- Link GA4 to Google Ads
- Track ad conversions
- Import conversions to Ads