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
- Go to analytics.google.com
- Click Admin → Create Property
- Enter your property name, timezone, and currency
- Select Web as your platform
- Enter your Odoo website URL
- 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:
- Go to Website → Configuration → Settings
- Scroll to SEO section
- Paste your GA4 Measurement ID (G-XXXXXXXX) in the Google Analytics field
- 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:
- Go to Website → Configuration → Settings
- Find Head Code or go to Website editor → HTML/Header
- 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 Event | Odoo Action | Data Captured |
|---|---|---|
| view_item | Product page view | Product name, price, category |
| add_to_cart | Add to cart click | Product, quantity, value |
| begin_checkout | Checkout page load | Cart items, total value |
| purchase | Order confirmation | Order 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:
- Go to GA4 → Admin → Events
- Find the events you want to track as conversions
- Toggle Mark as conversion for: purchase, generate_lead, sign_up
- 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:
- In GA4, go to Admin → Google Ads Links
- Link your Google Ads account
- Enable auto-tagging in Google Ads
- 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.