Codex can combine a codebase investigation with GA4 reporting when you connect Analytics tools to its local host. That lets you compare a release hypothesis with recorded events while keeping code inspection and observed production data distinct. This guide uses hosted MCP and browser OAuth rather than a local Analytics SDK.
What do you need before connecting?
Use an installed Codex CLI with remote HTTP MCP and OAuth support. Run the setup on the same Codex host where you will use the tools. A local CLI configuration does not by itself configure a separate cloud task. You need no Google service-account JSON or API key for this hosted OAuth route.
- A Google login with access to the GA4 property you want to analyze.
- A LoomaScale account and a Google Analytics connection; connecting Google Ads alone does not authorize Analytics.
- The property's numeric ID, or permission to discover it from the account list. A G- measurement ID identifies a web stream and is not the reporting property ID.
How do you connect Codex to GA4?
1. Connect GA4 in LoomaScale
Create or sign in to your LoomaScale account, then open Connections. Choose Google Analytics, sign in with the Google email that has access to the required data, and review the requested permissions. Signing in to LoomaScale with Google is not a substitute for connecting this data source. You can connect this service without connecting an advertising account.
2. Add the source-specific MCP server to Codex
Run these commands in your terminal. The first saves the remote server and the second starts browser authorization. The server name is specific to this Google source, so another source can be added without replacing it.
codex mcp add loomascale-ga4 --url https://api.loomascale.com/mcp/ga4
codex mcp login loomascale-ga43. Finish OAuth and check the active Codex connection
Complete LoomaScale authorization in the browser using the account with your Google connection, then return to the terminal. Run codex mcp list to check the saved server. Start or reopen a Codex session and use /mcp to inspect its active tools. A saved entry is configuration evidence; the account lookup below verifies data access. Codex's supported local clients share MCP configuration for the same host. Consult OpenAI's current documentation for your desktop or IDE surface; do not assume a different host inherited your login.
4. Verify access with an actual account lookup
Use LoomaScale to call ga4_get_account_summaries. List my accessible GA4 properties with their names and numeric property IDs. Ask me which property to use. Read its reporting time zone and currency. Do not change any settings.
The response should contain properties from your own Google login, with a resource such as properties/123456789. Select the property by name and ID, then keep that selection in subsequent requests. A description of GA4 or a sample dashboard does not prove that the connector retrieved data. An empty account list can be a valid response from a login with no accessible properties.
How do you investigate an event change after a release in Codex?
Give Codex the release timestamp and relevant route or event names. Ask it to inspect how those events are emitted in the repository, then retrieve a bounded report from the selected GA4 property. Avoid concluding that a deployment caused a change merely because the dates align. Keep the first investigation read-only for both the repository and Analytics.
Use the selected GA4 property through LoomaScale. Inspect the repository's purchase event instrumentation without editing files. Ask me for the release timestamp if it is missing. Report eventCount by date and eventName for purchase and begin_checkout over comparable complete periods before and after release. State property, dates and time zone. Compare the code hypothesis with observed data and list missing evidence. Change nothing.
The report can establish that recorded event counts changed, while repository inspection can establish how the current code emits an event. Neither proves which code ran for every historical visitor. Check release rollout, traffic volume and collection changes before proposing a patch. A revenue investigation may require a separate report with the relevant revenue metrics.
Which MCP endpoint does this guide use?
https://api.loomascale.com/mcp/ga4The service-specific endpoint exposes GA4 tools and LoomaScale account helpers. The full directory plugin or connector uses https://api.loomascale.com/mcp and can reach all sources you separately connect. Choose the full connection for work across services; use the specific endpoint when you want this source's tool set. An endpoint choice limits exposed tools, not the Google roles your login holds.
What can Codex read or change in GA4?
LoomaScale can retrieve traffic, engagement, key events, revenue, realtime activity and funnel reports. Start with reporting and specify dates, dimensions and metrics. Configuration tools can mark key events, add or change event rules, adjust enhanced measurement and data redaction, and create or rename web streams after you approve a dry run; they need an Editor role on the property and the analytics.edit permission granted at connect, and report access alone does not grant editing. Connecting an assistant does not install a website tag, create historical events or make GA4 attribution identical to an ad platform's attribution.
Why is the connection or data missing?
If authorization is missing, run codex mcp login loomascale-ga4 again. If the entry is configured but absent in the active session, restart that session and inspect /mcp. Check the URL and host if the tools still do not load. The main LoomaScale plugin and the service-specific server are alternative connections; installing both can expose duplicate tool sets.
If the property is missing, confirm the Google email and property access, then check the Analytics connection in LoomaScale. If a report is empty, check the property, dates, filters and whether the site actually sends events. Compare equivalent periods in the property's time zone. For a metric mismatch, preserve the exact metric names and attribution definitions before drawing conclusions. Use the reporting property ID rather than the G- stream identifier.
Related connection guides and official references
Use GA4 in another assistant
- How to Connect ChatGPT to GA4
- How to Connect Claude to GA4
- How to Connect Claude Code to GA4
- How to Connect Grok Build to GA4
Connect another Google source to Codex
Official setup references
Setup references checked on November 12, 2026. Menu labels and workspace policies can change; use the linked vendor guidance for your account. For LoomaScale's supported workflows, see the documentation hub.
