> ## Documentation Index
> Fetch the complete documentation index at: https://docs.markifact.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Send Events

> Sends server-side events into a Google Analytics 4 data stream through the Measurement Protocol: offline conversions, CRM leads, refunds, purchases with items

Sends server-side events into a Google Analytics 4 data stream through the Measurement Protocol: offline conversions, CRM leads, refunds, purchases with items. Every batch is validated by Google first and rejected events are reported; events must carry a client id (web) or app instance id (apps) and can be backdated up to 72 hours.

| | |
| - | - |
| **App** | GA4 |
| **Operation ID** | `ga4_send_events` |
| **Type** | Action |
| **Connection** | `ga4` (required) |
| **Credits per run** | 1 |
| **Agent / MCP tool** | Yes |
| **Requires approval** | Yes (write operation) |

## Inputs

| Field | Type | Required | Default | Description |
| - | - | - | - | - |
| `account` | array (also accepts a comma-separated string) | No | - | The GA4 property that owns the data stream. Only one property at a time. |
| `data_stream_id` | string | Yes | - | Numeric id of the data stream to send to. The measurement id (web) or Firebase app id (apps) and a Measurement Protocol secret are read from the stream; a secret named 'Markifact' is created on the stream if it has none. Read stream ids from ga4\_get\_property\_settings with setting 'data\_streams'. |
| `client_id` | string | No | - | Web streams: the visitor's GA client id, e.g. '1234567890.1700000000' (the \_ga cookie value without the 'GA1.1.' prefix). Required for web streams so the event joins the visitor's history. |
| `app_instance_id` | string | No | - | App streams: the Firebase app instance id of the device. Required for app streams. |
| `user_id` | string | No | - | Optional user id for cross-device analysis. |
| `events` | array of object or string | Yes | - | Events to send, as the Measurement Protocol events array (object or JSON string): \[\{"name":"purchase","params":\{"transaction\_id":"T123","value":99.9,"currency":"USD","session\_id":"1700000000","engagement\_time\_msec":100,"items":\[\{"item\_id":"SKU1","item\_name":"Plan","price":99.9,"quantity":1}]}}]. Include params.session\_id and params.engagement\_time\_msec so the events appear in standard reports. Event names max 40 chars, 25 params per event; more than 25 events are sent in batches. Google validates names and values. |
| `timestamp_micros` | integer | No | - | Unix time in microseconds for all events, at most 72 hours in the past. Omit for now. |
| `user_properties` | object or string | No | - | Optional user properties object: \{"plan":\{"value":"pro"}}. Max 25. |
| `consent` | object or string | No | - | Optional consent object: \{"ad\_user\_data":"GRANTED","ad\_personalization":"DENIED"}. |
| `region` | string or SelectableOption | No | - | 'global' (default) or 'eu' to send through Google's EU collection endpoint. |
| `validate_only` | boolean | No | - | When true, events are only validated by Google and not recorded. |

### SelectableOption

| Field | Type | Required | Default | Description |
| - | - | - | - | - |
| `value` | string | Yes | - | |
| `label` | string | Yes | - | |

## Output

**Type**: `Dict`

Returns how many events were validated and sent, in how many requests, and the stream's measurement id or Firebase app id.

**Fields**: `property_id`, `data_stream_id`, `stream_type`, `events_sent`, `events_validated`, `requests`, `validate_only`, `measurement_id`, `firebase_app_id`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.