GA4 conversions by source
ga4_conversions_by_sourceConversions and conversion-attributable revenue by traffic source.
Returns currency, time_zone, the date range, and rows with
sessionSource + sessionMedium + sessions + conversions +
sessionKeyEventRate + totalRevenue + purchaseRevenue (where applicable).
Sorted by conversions desc.
Read the rate from sessionKeyEventRate, never by dividing conversions
by sessions. A key event is counted every time it fires, so that division
exceeds 100% on any property where sessions trigger more than one.
key_events is the same total broken out by event name, and it is the
field that keeps an answer honest. A property marks whatever it likes as
a key event: on a real shop measured here, 11,611 of them over a month
were 6,066 add_to_cart, 2,797 login and 535 logout, against 203
purchases. sessionKeyEventRate for that month was 38.9%, which is true
and means "38.9% of sessions did one of ten things, including logging
out". The number a merchant means by "conversion rate" was 203/6,625, or
3.1%. Quote the overall rate only with the breakdown beside it, and for a
shop prefer transactions and purchaseRevenue.
This used to return the bare row list. Google reports the property's
currency and time zone in every response, and taking ["rows"] threw
both away, so revenue came back as a bare number: 70114.77 of nothing.
It was AUD. The dates had the same problem, since "the last 28 days" is
cut in the property's own zone, which for that property is
Australia/Melbourne, ten hours off UTC.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | No | lookback window, default 28 | |
| limit | No | max rows, default 20 | |
| property_id | Yes | GA4 property id |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||