Skip to content

How to Connect Google Analytics 4 to Odoo Website: Complete Tracking Guide

DeployMonkey Team · March 23, 2026 10 min read

Why GA4 on Your Odoo Website?

Odoo has built-in website analytics, but they are basic — page views, visitor counts, and referral sources. Google Analytics 4 provides the depth marketers need: user journeys, conversion funnels, audience demographics, acquisition channels, and integration with Google Ads. If you run any paid advertising or need serious marketing analytics, GA4 is essential.

Prerequisites

  • Odoo 17 or 18 with the Website module installed
  • Google Analytics 4 property (not Universal Analytics — that was sunset in 2024)
  • Admin access to your Odoo website settings

Step 1: Create a GA4 Property

  1. Go to analytics.google.com
  2. Click Admin → Create Property
  3. Enter your property name, timezone, and currency
  4. Select Web as your platform
  5. Enter your Odoo website URL
  6. Copy the Measurement ID (starts with G-)

Step 2: Add GA4 to Odoo (Method 1 — Built-in Setting)

Odoo 17+ has a native Google Analytics field:

  1. Go to Website → Configuration → Settings
  2. Scroll to SEO section
  3. Paste your GA4 Measurement ID (G-XXXXXXXX) in the Google Analytics field
  4. Click Save

This injects the gtag.js script into every page automatically.

Step 3: Add GA4 to Odoo (Method 2 — Custom Header Code)

For more control over the GA4 configuration, inject the script manually:

  1. Go to Website → Configuration → Settings
  2. Find Head Code or go to Website editor → HTML/Header
  3. Paste the GA4 snippet:
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXX', {
    'cookie_flags': 'SameSite=None;Secure'
  });
</script>

Step 4: Set Up eCommerce Tracking

If you use Odoo's eCommerce module, configure GA4 eCommerce events for full funnel tracking:

GA4 EventOdoo ActionData Captured
view_itemProduct page viewProduct name, price, category
add_to_cartAdd to cart clickProduct, quantity, value
begin_checkoutCheckout page loadCart items, total value
purchaseOrder confirmationOrder ID, revenue, items

Odoo's built-in GA integration handles basic page tracking. For eCommerce events, you need custom JavaScript on the relevant pages. Add dataLayer pushes to the product page template, cart template, and confirmation page.

// Example: Push purchase event on order confirmation
<script>
  gtag('event', 'purchase', {
    transaction_id: '${order.name}',
    value: ${order.amount_total},
    currency: '${order.currency_id.name}',
    items: [
      % for line in order.order_line:
      {
        item_id: '${line.product_id.default_code}',
        item_name: '${line.product_id.name}',
        price: ${line.price_unit},
        quantity: ${int(line.product_uom_qty)}
      },
      % endfor
    ]
  });
</script>

Step 5: Configure Conversions

In GA4, mark key events as conversions:

  1. Go to GA4 → Admin → Events
  2. Find the events you want to track as conversions
  3. Toggle Mark as conversion for: purchase, generate_lead, sign_up
  4. These now appear in GA4's Conversions report and can be imported into Google Ads

Step 6: Link Google Ads (Optional)

If you run Google Ads, link your GA4 property:

  1. In GA4, go to Admin → Google Ads Links
  2. Link your Google Ads account
  3. Enable auto-tagging in Google Ads
  4. Import GA4 conversions into Google Ads for smart bidding

Troubleshooting

No Data Appearing in GA4

GA4 has a 24-48 hour processing delay for most reports. Use the Realtime report to verify tracking is working immediately. Install the Google Tag Assistant browser extension to debug tag firing on your Odoo pages.

Tracking Blocked by Cookie Consent

If you use Odoo's cookie consent banner (required for GDPR), GA4 may not fire until the user accepts analytics cookies. Configure the consent mode in your gtag config to handle this properly.

Double Counting Page Views

If you use both Method 1 (built-in setting) and Method 2 (custom header), GA4 loads twice and double-counts everything. Use only one method.

DeployMonkey Analytics Setup

DeployMonkey instances support GA4 out of the box. Our AI agent can verify your tracking implementation, check for common configuration errors, and help you set up eCommerce conversion tracking — all through a simple conversation.