___INFO___ { "type": "MACRO", "id": "cvt_temp_public_id", "version": 1, "securityGroups": [], "displayName": "DataNostro — GA4 Session ID", "description": "Extracts the GA4 session id from the _ga_ cookie. Useful for joining server events with GA4 sessions.", "containerContexts": ["SERVER"] } ___TEMPLATE_PARAMETERS___ [ {"type": "TEXT","name": "container_id","displayName": "GA4 Container ID","simpleValueType": true,"valueValidators": [{"type":"NON_EMPTY"}],"help": "Numeric part of G-XXXXXXXX (no G- prefix)."} ] ___SANDBOXED_JS_FOR_SERVER___ const getCookieValues = require("getCookieValues"); const cookie = getCookieValues("_ga_" + data.container_id); if (!cookie || !cookie.length) return undefined; const parts = cookie[0].split("."); return parts.length >= 3 ? parts[2] : undefined; ___SERVER_PERMISSIONS___ [ {"instance": {"key": {"publicId": "get_cookies"}, "param": [{"key": "cookieAccess","value": {"type": 1,"string": "any"}}]}} ] ___TESTS___ scenarios: [] ___NOTES___ GA4 stores session id at index 2 of the _ga_ cookie value (dot-separated).