For general GA4 concepts, see the Google Analytics 4 overview.
Prerequisites
- Google Analytics 4 property created
- GA4 Measurement ID (G-XXXXXXXXXX)
- Volusion admin access
Installation Methods
Method 1: Template Header Injection (Recommended)
- Log into Volusion admin
- Go to Design > File Editor
- Open
template_header.htmlorheader.html - Before the closing
</head>tag, add:
<!-- 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>
Method 2: Settings > Global JavaScript
- Go to Settings > All Settings
- Search for "JavaScript" or "Tracking"
- Add GA4 code to Global Header Scripts
- Save changes
Method 3: Via Google Tag Manager
For more flexibility:
- Install GTM: GTM Setup for Volusion
- Add GA4 Configuration tag in GTM
- No additional Volusion changes needed
Ecommerce Tracking
Product Views
Add to product template:
<script>
gtag('event', 'view_item', {
currency: 'USD',
value: %product_price%,
items: [{
item_id: '%product_code%',
item_name: '%product_name%',
price: %product_price%
}]
});
</script>
Add to Cart
<script>
// Track add to cart clicks
document.querySelector('.add-to-cart').addEventListener('click', function() {
gtag('event', 'add_to_cart', {
currency: 'USD',
value: %product_price%,
items: [{
item_id: '%product_code%',
item_name: '%product_name%',
price: %product_price%
}]
});
});
</script>
Purchase Tracking
Add to order confirmation template:
<script>
gtag('event', 'purchase', {
transaction_id: '%order_id%',
value: %order_total%,
currency: 'USD',
items: [
// Loop through order items if available
]
});
</script>
Verification
- View Page Source: Search for "gtag.js"
- GA4 Realtime: Check Reports > Realtime
- Google Tag Assistant: Use browser extension
- Test purchase: Complete test order to verify
Common Issues
Code not loading:
- Clear template cache
- Verify correct template file edited
- Check for syntax errors
Variables not populating:
- Ensure correct variable syntax (%variable%)
- Verify on correct page type
- Test with actual values