How to set up website data stream on Google Analytics
Setting up a website data stream in Google Analytics involves creating a GA4 property, adding a web data stream, and installing the tracking code on your website. This enables Google Analytics to collect visitor data and track user behavior on your site.
Prerequisites
- Google Analytics account
- Website admin access
- Basic understanding of HTML
Step-by-Step Instructions
Access Google Analytics Admin Panel
Navigate to Data Streams
Add New Web Stream
Configure Stream Settings
Copy the Measurement ID
Install Global Site Tag (gtag.js)
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>Paste this code in the <head> section of every page you want to track, preferably right after the opening <head> tag.Verify Data Collection
Common Issues & Troubleshooting
Tracking code not collecting data
Verify the tracking code is properly installed in the <head> section of all pages. Check browser console for JavaScript errors and ensure the Measurement ID matches exactly. Clear your browser cache and test in incognito mode.
Multiple Google Analytics codes on same page
Remove any old Universal Analytics (UA-XXXXXXXX) codes if you're migrating to GA4. Having multiple tracking codes can cause data discrepancies. Use Tag Assistant Legacy Chrome extension to identify conflicting tags.
Data stream not showing in Admin panel
Ensure you have Editor or Administrator permissions for the Google Analytics property. If you're part of an organization, ask the account owner to grant appropriate access levels.
Realtime reports show no activity despite website visits
Check if ad blockers or privacy extensions are blocking Google Analytics. Test from different browsers and devices. Verify the website URL in stream settings matches your actual domain exactly, including www or non-www versions.