___INFO___ { "type": "TAG", "id": "cvt_temp_public_id", "version": 1, "securityGroups": [], "displayName": "DataNostro — GA4 Event", "description": "Forward an arbitrary event to GA4 Measurement Protocol. Measurement ID + API secret as variables.", "containerContexts": ["SERVER"] } ___TEMPLATE_PARAMETERS___ [ {"type": "TEXT","name": "measurement_id","displayName": "Measurement ID","simpleValueType": true,"valueValidators": [{"type":"NON_EMPTY"}]}, {"type": "TEXT","name": "api_secret","displayName": "API Secret","simpleValueType": true,"valueValidators": [{"type":"NON_EMPTY"}]}, {"type": "TEXT","name": "event_name","displayName": "Event name","simpleValueType": true,"defaultValue": "page_view"} ] ___SANDBOXED_JS_FOR_SERVER___ const sendHttpRequest = require("sendHttpRequest"); const getEventData = require("getEventData"); const url = "https://www.google-analytics.com/mp/collect?measurement_id=" + data.measurement_id + "&api_secret=" + data.api_secret; const body = { client_id: getEventData("client_id"), events: [{name: data.event_name, params: getEventData("event_parameters") || {}}] }; sendHttpRequest(url, {method: "POST", headers: {"Content-Type": "application/json"}}, JSON.stringify(body)); data.gtmOnSuccess(); ___SERVER_PERMISSIONS___ [ {"instance": {"key": {"publicId": "send_http"}, "param": [{"key": "allowedUrls","value": {"type": 1,"string": "specific"}},{"key": "urls","value": {"type": 2,"listItem": [{"type": 1,"string": "https://www.google-analytics.com/*"}]}}]}} ] ___TESTS___ scenarios: [] ___NOTES___ Measurement Protocol API. Configure GA4 → Admin → Data Streams → Measurement Protocol API secrets.