Other tools

Connect Google Analytics 4

Updated

Add Google Analytics 4 as a destination under Connections › Tracking & destinations with your Measurement ID and a Measurement Protocol API secret: purchases and refunds then reach GA4 from the server. Separately, sign in with Google under Connections › Channels to read GA4 sessions and key events in ROASaurus.

Two connections, two directions

  • Sending (destination): ROASaurus posts purchases, refunds and, if you choose, other events to GA4's Measurement Protocol. Purchases are deduplicated by transaction id, so they can run next to your own GA4 tag. Available on every plan, Free included.
  • Reading (Google login): ROASaurus reads sessions, users, key events and revenue per day from the GA4 property you pick, for Website › Search and the warehouse table ga4_daily.

Before you start

  • A GA4 property with a web data stream for your store, and the Editor role on it (to create an API secret).
  • The owner or admin role in ROASaurus to add destinations.
  • For the hashed user data option: user-provided data collection turned on in GA4.

Steps

  1. Copy the Measurement ID

    In GA4, open Admin › Data streams and your web stream. Copy the Measurement ID (G- followed by letters and numbers).

  2. Create an API secret

    On the same stream, open Measurement Protocol API secrets, click Create, give it a name such as ROASaurus and copy the secret value.

  3. Add the GA4 destination

    In ROASaurus, open Connections › Tracking & destinations, find Google Analytics 4 under Analytics and data and click Add pixel. Paste the Measurement ID and the API secret. Tick Send to the EU endpoint if your property should receive data through region1.google-analytics.com.

    You should see: The destination with Purchase and Refund ticked; those two are the default.

  4. Choose the events

    Keep Purchase and Refund. Tick page views and cart events only when the GA4 tag is not on your site: GA4 does not deduplicate those between its own tag and the Measurement Protocol.

  5. Choose what to send with purchases (optional)

    Under Conversion value and profit signals, Profit can stay off, replace the purchase value, or go along as a gross_profit parameter while the value stays revenue. You can also send predicted_ltv for a new customer's first order and customer_type (new or returning). Register gross_profit and predicted_ltv as custom metrics in GA4 to report on them.

  6. Test, then save

    Tick Test mode to send to GA4's validation server (events are checked, not recorded), place a test order, and check Data quality › Deliveries. Untick test mode when the events pass.

    You should see: Each delivery with status sent and GA4's answer.

  7. Read GA4 in ROASaurus (optional)

    Open Connections › Channels, click Connect on Google, sign in with a Google account that can read the property, and pick the GA4 property (and a Search Console property if you like).

    You should see: Website › Search › Google Analytics 4 with sessions and key events per day, after the first sync.

Each purchase carries the visitor's _ga client id when the storefront script read it, and the GA4 session of that visit, so GA4 can join it to the session. Without marketing consent the event goes out anonymous: no user id, user data, IP address or browser details, and its client id is derived from the order alone. Consent Mode signals ad_user_data and ad_personalization follow the shopper's marketing consent.

Options: Send the shop customer id as user_id (only if User-ID is part of your GA4 setup and privacy notice) and Send hashed email, phone and address (user-provided data, SHA-256 hashed as Google asks).

Late orders

GA4 accepts Measurement Protocol events up to 72 hours old. Orders that arrive later, such as imported history, are not sent.

Common problems

“The Measurement ID looks like G-XXXXXXXXXX.”
You pasted another id (a stream id or an old Universal Analytics id). Copy the Measurement ID from the web stream's details.
Purchases are counted twice in GA4
Another app (or your theme) also sends purchases with a different transaction id. Keep one sender of purchases to this property.
Page views doubled after ticking them
The GA4 tag is also on the site. Untick PageView and the cart events on the ROASaurus destination.
“Pick a GA4 property to read sessions and key events.”
The Google login works but no property is chosen. Pick it on Connections › Channels.
“Could not list Google properties: …”
The Google account you signed in with has no access to the property. Ask for Viewer access in GA4, then connect again.

Next step

Want GA4 next to orders and profit in your own warehouse?

Export your data to BigQuery

Still stuck? Email us.

Every sale, traced to the ad that earned it

Server-side tracking, profit and lifetime value in one app. Free plan, no credit card.