How can I track 404 error pages using GTM and GA4?
Asked on Oct 07, 2025
Answer
Tracking 404 error pages using Google Tag Manager (GTM) and Google Analytics 4 (GA4) involves setting up a custom event to capture when users land on a 404 page. This can help you monitor and address broken links on your site.
<!-- BEGIN COPY / PASTE -->
1. In GTM, create a new Trigger:- Trigger Type: Page View
- This trigger fires on: Some Page Views
- Condition: Page Path contains "404"
2. Create a new Tag in GTM:- Tag Type: GA4 Event
- Configuration Tag: Choose your GA4 Configuration Tag
- Event Name: "404_error"
- Trigger: Select the 404 Page View Trigger created earlier
<!-- END COPY / PASTE -->Additional Comment:
- Ensure your 404 error pages have a consistent URL pattern (e.g., "/404") for the trigger to work effectively.
- After setting up, test the trigger and tag using GTM's Preview mode to confirm they fire correctly on a 404 page.
- In GA4, you can view these events under Reports → Engagement → Events to analyze the frequency and sources of 404 errors.
Recommended Links: