Google Analytics 4 eCommerce & Server-Side Tracking (CodeTrade)
by CodeTrade India Pvt. Ltd. https://www.codetrade.io$ 120.00
Google Analytics 4 eCommerce & Server-Side Tracking
Every GA4 eCommerce Event — and Purchases Ad Blockers Can't Hide
GA4 eCommerce Tracking sends the full Google Analytics 4 eCommerce journey of your Odoo eShop: product lists, searches, product views, add to cart, cart, checkout, payment and purchase, each with GA4 items (ID, name, category, variant, price and quantity), through the Google tag or Google Tag Manager.
Purchases and refunds are also sent server-side through the GA4 Measurement Protocol when an order is confirmed or cancelled, so revenue still reaches Google Analytics with ad blockers, Safari ITP or offline payments. Consent Mode v2, a retrying queue and a debug log are included.
Depends only on the standard eCommerce app (website_sale). A Google Analytics 4 property is required; server-side events also need a Measurement Protocol API secret from your GA4 data stream.
View DemoEverything you need to measure your Odoo shop in GA4
Install the module, enter your GA4 measurement ID (and the API secret for server-side events) in GA4 Tracking → Configuration, and every shop page starts sending GA4 eCommerce events.
Key Features
Google Tag or Google Tag Manager
Load the Google tag (gtag.js) with your G- measurement ID, push to the Google Tag Manager dataLayer (the ecommerce object is cleared before each event, as Google recommends), or send server-side only. One configuration per website.
Complete GA4 eCommerce Events
view_item_list and search on shop and category pages, view_item on product pages, add_to_cart from the product page and shop tiles, view_cart, begin_checkout, add_payment_info and purchase, each with GA4 items. Every event can be switched off.
Server-Side Purchases and Refunds
A purchase is sent through the GA4 Measurement Protocol when a website order is confirmed, whatever the payment method and also when it is confirmed later in the back office, and a refund when a tracked order is cancelled. GA4 deduplicates browser and server purchases on the transaction ID.
Reliable Event Queue
Server events are queued and sent by a scheduled action with up to 5 attempts, can be resent or cancelled by hand and are created only once per order. The visitor's GA client and session IDs are captured at checkout, with a stable generated ID as fallback.
Consent Mode v2
Default state for ad_storage, analytics_storage, ad_user_data and ad_personalization with a wait time, updated to granted when the visitor accepts Odoo's cookie bar. Third-party banners can call window.ctGa4Consent('granted') or ('denied').
Debug Mode and Sandbox
Debug mode adds debug_mode for GA4 DebugView, checks server events against Google's validation server, shows an on-page badge of the events pushed and logs every browser event in the back office. Sandbox mode and Send Test Event let you try everything safely.
Clean Analytics Data
Logged-in employees are excluded, the order value is sent with or without taxes, the item ID comes from the internal reference, barcode or product ID, and a warning appears when Odoo's own Google Analytics key would count page views twice.
Event Log and Analysis
Server Events and Browser Debug Log list every event with its order, value, status, attempts and full payload, and Event Analysis summarises them by event and status. GA4 Users read, GA4 Managers configure; multi-company rules apply.
GA4 Configuration
GA4 Tracking → Configuration: one configuration per website with the measurement ID, browser tag, API secret, sandbox and debug options. The Sent, Queued and Failed buttons open the events of that status.
Choose the browser events and how purchases, refunds, order value and item ID are sent.
Consent Mode v2 default state, wait time and Odoo cookie bar integration.
Events on Your Shop
With debug mode on, the badge at the bottom left lists every event pushed. A search on the shop sends view_item_list and search.
A product page sends view_item with the item ID, category and price.
Add to cart sends add_to_cart with the quantity and value.
The cart sends view_cart, then begin_checkout and add_payment_info during checkout.
Server-Side Purchases
When the order is confirmed a purchase is queued with the order number, value, taxes, shipping and items, and sent to the Measurement Protocol.
Cancelling a tracked order queues a refund for the same transaction.
Server Events lists every purchase, refund and test event with its status and attempts.
Debug Log and Analysis
In debug mode every browser event is logged with its page and payload.
Event Analysis summarises events by name and status.
Send Test Event checks the API secret (here in sandbox mode).
Tag Manager and Consent
Switch the website to Google Tag Manager by choosing it as browser tag and entering the container ID.
With Odoo's cookie bar on, consent stays denied until the visitor clicks I agree.
Version 1.0 : 18.0.0.0.0
08 October 2026
This module cannot be used with Odoo Online (SaaS). It is compatible with Odoo Community, Enterprise, and Odoo.sh deployments.
A GA4 property and its web data stream measurement ID (G-XXXXXXXXXX). For server-side purchases and refunds, create a Measurement Protocol API secret in GA4 Admin → Data streams → your web stream. For Google Tag Manager, your GTM container ID.
No. Both carry the order number as transaction_id and GA4 deduplicates purchases on it. The server-side event makes sure the purchase is still recorded when the browser event is blocked.
Yes. With Consent Mode v2 the default state is denied until the visitor accepts Odoo's cookie bar. Without a cookie bar Odoo considers consent given. Other consent banners can call window.ctGa4Consent('granted') or ('denied').
No. Remove it, otherwise page views are counted twice. The GA4 configuration shows a warning while it is set.
Yes. Sandbox mode queues and logs server events and simulates Google's answer. Debug mode sends events to GA4 DebugView and validates server events against Google's validation server, and Send Test Event checks the API secret.
You May Also Like
Language Translation
Our Services
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
eCommerce (website_sale)
• Website (website) • Invoicing (account) • Discuss (mail) |
| Lines of code | 1056 |
| Technical Name |
ga4_ecommerce_tracking_codetrade |
| License | OPL-1 |
| Website | https://www.codetrade.io |
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module