How to Add Google Analytics 4 to Volusion | OpsBlu Docs

How to Add Google Analytics 4 to Volusion

Install GA4 on your Volusion store using the built-in analytics integration. Covers Measurement ID setup and ecommerce tracking.

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

  1. Log into Volusion admin
  2. Go to Design > File Editor
  3. Open template_header.html or header.html
  4. 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>
  1. Replace G-XXXXXXXXXX with your Measurement ID
  2. Save the template
  3. Clear template cache

Method 2: Settings > Global JavaScript

  1. Go to Settings > All Settings
  2. Search for "JavaScript" or "Tracking"
  3. Add GA4 code to Global Header Scripts
  4. Save changes

Method 3: Via Google Tag Manager

For more flexibility:

  1. Install GTM: GTM Setup for Volusion
  2. Add GA4 Configuration tag in GTM
  3. 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

  1. View Page Source: Search for "gtag.js"
  2. GA4 Realtime: Check Reports > Realtime
  3. Google Tag Assistant: Use browser extension
  4. 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

Next Steps