For general GA4 concepts and features, see the Google Analytics 4 overview.
Prerequisites
- Google Analytics 4 property created
- GA4 Measurement ID (G-XXXXXXXXXX)
- Weebly paid plan (Personal, Professional, or Performance)
Installation Methods
Method 1: Weebly Native Integration (Limited)
Weebly has a built-in Google Analytics integration, but it has limitations:
- Go to Settings > SEO
- Find Header Code section
- This method is actually manual code injection
Note: Weebly doesn't have a native GA4-specific integration field like some platforms. Use the Header Code method below.
Method 2: Header Code Injection (Recommended)
This is the recommended method for GA4 installation on Weebly:
- Go to Settings > SEO
- Scroll to Header Code section
- Paste the Google Analytics 4 code:
<!-- Google 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>
- Replace
G-XXXXXXXXXXwith your actual Measurement ID - Click Save
- Publish your site to apply changes
Method 3: Via Google Tag Manager
If you're using GTM (recommended for complex tracking):
- Install GTM first: GTM Setup for Weebly
- Add GA4 Configuration tag in GTM
- No additional Weebly configuration needed
Configuration
Enhanced Measurement
GA4's Enhanced Measurement automatically tracks:
- Page views
- Scrolls (90% depth)
- Outbound link clicks
- Site search (if enabled)
- Video engagement (YouTube embeds)
- File downloads
To enable/disable Enhanced Measurement:
- Go to GA4 Admin > Data Streams
- Click your web stream
- Toggle Enhanced Measurement settings
Ecommerce Tracking (Performance Plan)
For Weebly stores on the Performance plan:
// Add to Header Code after GA4 base code
// Track product views
document.addEventListener('DOMContentLoaded', function() {
// Check if on product page
var productName = document.querySelector('.wsite-com-product-title');
var productPrice = document.querySelector('.wsite-com-product-price');
if (productName && productPrice) {
gtag('event', 'view_item', {
currency: 'USD',
value: parseFloat(productPrice.textContent.replace(/[^0-9.]/g, '')),
items: [{
item_name: productName.textContent.trim()
}]
});
}
});
Note: Weebly ecommerce tracking is limited. Consider using Square's analytics for comprehensive ecommerce data.
Verification
Check Installation
- View Page Source: Right-click > View Page Source > Search for "gtag.js"
- GA4 Realtime Report: Check Admin > Reports > Realtime
- Google Tag Assistant: Use browser extension to verify
Common Issues
Code not appearing:
- Ensure you're on a paid plan
- Clear Weebly cache and republish
- Check for syntax errors in code
Pageviews not tracking:
- Verify Measurement ID is correct
- Check for ad blockers
- Confirm Enhanced Measurement is enabled
Data Layer Events
For custom event tracking, you can push events to the data layer:
// Track custom events
gtag('event', 'button_click', {
'button_name': 'signup_cta',
'page_location': window.location.href
});
Cross-Domain Tracking
If you have multiple domains (e.g., main site and blog):
<script>
gtag('config', 'G-XXXXXXXXXX', {
'linker': {
'domains': ['yoursite.weebly.com', 'yoursite.com']
}
});
</script>