Connections
Connect Google Analytics 4 (Measurement Protocol)
Step by step: copy your GA4 Measurement ID, create a Measurement Protocol API secret, list your store under unwanted referrals, and import the purchase into Google Ads.
Updated
What LatchPay sends to Google Analytics
Once connected, LatchPay's server sends Google Analytics 4 every paid order as a purchase, with the payment id as transaction id. The Google tag in the browser sends the same purchase, and Google Analytics keeps one per transaction id. The checkout steps (begin_checkout, add_payment_info) keep coming from the browser only, because Google Analytics cannot merge those when they arrive twice.
With the API secret saved, the checkout and the server use the same visitor id as your storefront, so the purchase joins the visit it came from. Server-side tracking explains the rest.
- You need the Editor role on the Google Analytics property.
- In LatchPay, open Settings → Tracking for the right store: ids and secrets are saved per store.
Connect Google Analytics, step by step
Open Google Analytics
Open Google Analytics and choose your store’s property. Open Google Analytics
Open Admin
Click Admin (the gear at the bottom left).
Open Data streams
Under Data collection and modification, click Data streams.
Choose your web stream
Click the web stream with your store’s web address.
Copy the Measurement ID
Copy the Measurement ID at the top of the stream details. It starts with G-, followed by about 10 letters and digits.
Paste the Measurement ID
Paste it into Measurement ID on the Google Analytics 4 card in LatchPay.
Open API secrets
Back in the same stream in Google Analytics, click Measurement Protocol API secrets.
Accept the terms if asked
If Google first shows Review terms, click it and then I acknowledge. Google asks this once per property before it lets you create an API secret.
Create an API secret
Click Create, type LatchPay as the nickname and click Create again. An API secret works like the access token of other platforms: a long code that works like a password and lets LatchPay send purchases to this stream.
Copy the secret
Copy the Secret value.
Paste the secret
Paste it into Measurement Protocol API secret on the Google Analytics 4 card.
Save
Click Save. The card now says Pixel + server.
LatchPay stores the secret encrypted and only ever shows its last four characters. To replace it, paste a new one and click Save.
Send a test event
Send the test event
Click Send test event on the Google Analytics 4 card.
Open DebugView
In Google Analytics, click Admin, then DebugView under Data display.
What you should see: Within a minute an event named latchpay_test shows up in DebugView. Google accepts events even with a wrong API secret, so seeing latchpay_test there is the real proof.
Before that event, LatchPay has Google's validation server check a purchase-shaped event; that one never shows in reports.
If it does not work: The API secret was made in another stream: create it in the stream whose Measurement ID you pasted. Or the Measurement ID has a typo: copy it again from the stream details.
Google accepts events even with a wrong API secret, so neither LatchPay nor Google can confirm the secret itself. For the same reason, "sent" on the card means Google's server accepted the event.
Two recommended settings
1. Keep the ad click. Without this, the step from your store to the checkout can start a new visit that looks like it came from your own store, and the purchase loses the ad click that brought the buyer.
Open the tag settings
In the same web stream, click Configure tag settings, then Show all.
Open unwanted referrals
Click List unwanted referrals.
Add your store
Type your store’s domain, for example yourstore.com, into Domain and click Save.
2. Let Google use the buyer details. Click Admin, then Data collection under Data collection and modification, and turn on user-provided data collection. Google can then use the hashed (scrambled) email, phone and address LatchPay sends with each purchase to match it to a Google account.
Count the purchases in Google Ads
LatchPay does not connect to Google Ads itself. You import the Google Analytics purchase into Google Ads once:
Link Google Ads
In Google Analytics, click Admin, then Google Ads links under Product links. If your Google Ads account is not listed, click Link and follow the steps.
Open Goals
In Google Ads, open Goals and click Summary.
Create a conversion
Click + Create conversion action and choose your Google Analytics property.
Choose purchase
Tick purchase, click Select events, then Save and continue.
Google Ads can take up to 24 hours to show the first imported purchases. Google Analytics marks purchase as a key event by default, so it is in the list.
After your next order
- The day after a real order, Reports → Monetization → Ecommerce purchases lists one transaction with its payment id, not two.
- The purchase keeps the source of the visit (for example the ad), not your store as a referral.
- The Google Analytics 4 card shows when LatchPay last sent a purchase; Sent · 7 days counts purchases only.