Measurement Protocol

The GA4 Measurement Protocol lets the server send events to Google Analytics 4 when no browser is involved: a refund posted by the accountant, a lead that moves in the CRM pipeline, a sale at the point of sale, or a purchase confirmed days after the visit. The server events are queued, sent every few minutes, and visible in the server events list.

Set it up

  1. In Google Analytics, open Admin > Data streams, select your web stream, and under Measurement Protocol API secrets create a secret.

  2. In Odoo, go to Google ‣ Configuration ‣ Settings. In the Google Analytics block, enable Measurement Protocol and fill in:

Field

Description

Measurement ID

The GA4 measurement ID receiving the events. Leave it empty to use the measurement ID of the Google tag.

API Secret

The secret created in Google Analytics. Only administrators can see it.

Then choose what the server sends. All the events require the analytics consent of the visitor (or of the customer), except store purchases:

Option

Events sent

Refunds

A refund event when a credit note of a website order is posted. Enabled by default.

Lead Events

The lead stage events of the CRM (qualified, working, won, lost…) defined by the lead stage rules, and leads that do not come from a website form. Enabled by default.

Store Purchases

A purchase event for each paid point of sale order of an identified customer. See Store sales tracking.

Purchases from the Server

See Purchases from the server.

screenshot: google-settings-measurement-protocol
menu
Google ‣ Configuration ‣ Settings
shows
The Google Analytics block of the Google settings: the GA4 User ID and GA4 Debug Mode options, then the Measurement Protocol setting enabled with the measurement ID, the API secret (hidden), the five options, and the Server Events link.
highlight
The Measurement Protocol setting (red frame).
data
Measurement ID "G-ABCDE12345", secret hidden (throw-away).
notes
English UI, light theme, 1440px width, crop to the block.

Purchases from the server

By default, the purchase of a website order is sent by the browser of the customer when the confirmation page is displayed (see When is a purchase reported?). That fails for an order paid later by a bank transfer, or that you confirm by hand.

If Report Purchases is set to When the order is confirmed in the eCommerce tracking settings, enable Purchases from the Server: the purchase is then sent by the server when the order is confirmed, wherever the customer is, and the browser does not send it a second time. If you use Google Tag Manager, the purchase event of the data layer is flagged so that you can exclude it from your GA4 tag.

Important

The events are rejected by Google if they are older than 72 hours: an event that cannot be sent within three days is marked Discarded.

Validation mode

Enable MP Validation Mode while you test: the events are sent to Google’s validation server instead of the reports. Nothing is recorded, and the validation messages are displayed on the server events. Disable it to go live. See Testing and troubleshooting.