Note: This page contains technical instructions for implementing Google Analytics in the header. This should be done by an administrator with WordPress admin access.
Current Issue
The Google Analytics tracking code is currently appearing on pages instead of being properly implemented in the header. This affects both user experience and tracking accuracy.
Solution: Move Code to Header
Do NOT remove the Google Analytics code – it needs to be moved to the proper location.
Steps to Fix (WordPress Admin Required)
- Access WordPress Admin: Log into https://vallieinsurance.net/wp/wp-admin/
- Go to Appearance → Theme Editor (or use child theme)
- Edit header.php file (or use WordPress Customizer → Additional CSS)
- Locate the Google Analytics code currently visible on pages
- Copy the tracking code (usually starts with gtag or Google Analytics)
- Remove from current location where it’s displaying on pages
- Paste in header.php between <head> and </head> tags
- Save changes and test
Alternative Method: Use Plugin
If direct file editing is not preferred:
- Install “Insert Headers and Footers” plugin
- Go to Settings → Insert Headers and Footers
- Paste Google Analytics code in “Scripts in Header” field
- Remove code from current visible location
- Save settings
What the Code Should Look Like
<head>
... other head content ...
<!-- Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'GA_MEASUREMENT_ID');
</script>
<!-- End Google Analytics -->
</head>
Testing After Implementation
- Check that Google Analytics code no longer appears on page content
- Verify tracking is working in Google Analytics dashboard
- Test page load speed improvement
- Check that all pages are tracking properly
Benefits of Header Implementation
- Clean Page Content: Analytics code won’t show to visitors
- Better Tracking: Code loads early for accurate data
- Professional Appearance: No technical code visible to users
- SEO Improvement: Cleaner page content for search engines
- Performance: Proper loading order for analytics
Important Notes
- Always backup your website before making theme changes
- Test changes on staging site if available
- Keep a copy of the tracking code before moving it
- Consider using a child theme to prevent updates from overwriting changes
