{"id":20609,"date":"2026-09-27T11:58:58","date_gmt":"2026-09-27T09:58:58","guid":{"rendered":"https:\/\/www.lukaswojcik.com\/blog\/?p=20609"},"modified":"2026-11-16T03:37:36","modified_gmt":"2026-11-16T02:37:36","slug":"tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport","status":"publish","type":"post","link":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/","title":{"rendered":"Tutorial: Querying GA4 Analytics Advisor via API and Checking the Answer with runReport"},"content":{"rendered":"<p>How many sessions came from search results, paid ads or other channels? This tutorial asks Analytics Advisor, then adds a comparison week. A separate <code>runReport<\/code> request checks the numbers directly against a GA4 report. The questions and responses remain available as files.<\/p><p><strong>Documentation checked: 25 October 2026.<\/strong> The current Google guide calls the assistant Ask Advisor. Programmatic access uses <code>properties.chat<\/code> in <code>v1alpha<\/code>. Access and permissions must be available for the intended GA4 property. <a href=\"#source-1\">[1]<\/a> A saved test record from 27 September 2026 documents three real requests: all four channel groups for 1\u20137 September matched between the chat table and <code>runReport<\/code>. That was one historical test, not a guarantee for future responses. Private measurement values are not published.<\/p>\n<h2>1. Prepare a limited reporting question<\/h2><p>The example compares 1\u20137 September 2026 with 25\u201331 August 2026. Both weeks start on Tuesday and end on Monday. The start and end dates are included; the property reporting time zone applies. <code>sessions<\/code> counts sessions, while <code>sessionDefaultChannelGroup<\/code> divides that count by the standard channel groups assigned to sessions. The API requires these exact field names. <a href=\"#source-4\">[4]<\/a> <a href=\"#source-7\">[7]<\/a><\/p><p>A channel groups traffic sources, such as unpaid search results under Organic Search. Sessions are visits under the GA4 session rules, not a count of distinct people. A lower session count shows a decline in this report. The count alone cannot establish whether a new landing page or a marketing change caused the decline.<\/p>\n<h2>2. Authorize and save the first answer<\/h2><p>The three code blocks run in order in the same Bash session. Required tools are <code>gcloud<\/code> for signing in, <code>curl<\/code> for HTTP requests and <code>jq<\/code> for reading and generating JSON files. A new private working folder avoids overwriting files from an earlier run. The placeholders in the first block need the actual project ID, numeric property ID and client-file path. The Cloud project provides API access; the property ID selects the GA4 data. The Analytics Data API must be enabled in the project. The signed-in account needs property access and <code>serviceusage.services.use<\/code> on the project assigned to API usage.<\/p><p>OAuth permissions determine which API functions the sign-in can access. Chat needs <code>analytics.chatbot.read<\/code>; the later report needs <code>analytics.readonly<\/code>. The example requests both. <code>gcloud<\/code> stores credentials locally, and a new sign-in can replace existing Application Default Credentials. Credentials and access tokens must remain outside public webpages. <a href=\"#source-1\">[1]<\/a><a href=\"#source-3\">[3]<\/a><a href=\"#source-6\">[6]<\/a><\/p><p>The example uses a separate Desktop app OAuth client for the Analytics permissions. The downloaded JSON file is supplied through <code>--client-id-file<\/code>. Google documents this approach for permissions outside the usual Cloud set. <a href=\"#source-6\">[6]<\/a> Before each HTTP request, the script obtains an access token. A failed token command or an empty token stops the script before the request. HTTP failures also stop execution; automatic retries are not included.<\/p>\n\n<figure style=\"--cbb-digits:2\" class=\"cbb cbb--wrap cbb--numbers wp-block-code-beautifier-block-code\" data-lang=\"bash\"><figcaption class=\"cbb-head\"><span class=\"cbb-lang\">Shell<\/span><span class=\"cbb-actions\"><button type=\"button\" class=\"cbb-button cbb-button--wrap\" data-cbb-action=\"wrap\" aria-pressed=\"true\" title=\"Wrap long lines\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><path d=\"M2 4h12M2 8h9.5a2.5 2.5 0 0 1 0 5H8m0 0 1.5-1.5M8 13l1.5 1.5M2 12h3\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\/><\/svg><span class=\"cbb-sr\">Wrap long lines<\/span><\/button><button type=\"button\" class=\"cbb-button cbb-button--copy\" data-cbb-action=\"copy\" aria-label=\"Copy code\" data-cbb-status-done=\"Code copied to the clipboard.\" data-cbb-status-failed=\"Copying failed. The code is selected for copying with Ctrl+C or \u2318+C.\" data-cbb-status-noselect=\"Copying failed.\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><rect x=\"5.5\" y=\"5.5\" width=\"8\" height=\"8.5\" rx=\"1.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><path d=\"M10.5 3.5V3A1.5 1.5 0 0 0 9 1.5H4A1.5 1.5 0 0 0 2.5 3v6.5A1.5 1.5 0 0 0 4 11h.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><\/svg><span class=\"cbb-button-label\">Copy<\/span><\/button><\/span><\/figcaption><pre class=\"cbb-pre\" tabindex=\"0\" role=\"region\" aria-label=\"Code example: Shell\"><code class=\"cbb-code language-bash\" style=\"counter-reset:cbb-line 0;\"><span class=\"cbb-line\"><span class=\"cbb-comment\"># Bash; gcloud, curl and jq required<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-keyword\">set<\/span> <span class=\"cbb-attr\">-euo<\/span> pipefail\n<\/span><span class=\"cbb-line\"><span class=\"cbb-keyword\">export<\/span> PROJECT_ID=<span class=\"cbb-string\">'REPLACE_WITH_CLOUD_PROJECT'<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-keyword\">export<\/span> PROPERTY_ID=<span class=\"cbb-string\">'REPLACE_WITH_NUMERIC_PROPERTY_ID'<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-keyword\">export<\/span> OAUTH_CLIENT_FILE=<span class=\"cbb-string\">'REPLACE_WITH_DOWNLOADED_DESKTOP_CLIENT_JSON'<\/span>\n<\/span><span class=\"cbb-line\">gcloud auth application-default login <span class=\"cbb-attr\">--client-id-file<\/span>=<span class=\"cbb-string\">\"<\/span><span class=\"cbb-variable\">$OAUTH_CLIENT_FILE<\/span><span class=\"cbb-string\">\"<\/span> <span class=\"cbb-attr\">--scopes<\/span>=<span class=\"cbb-string\">\"https:\/\/www.googleapis.com\/auth\/cloud-platform,https:\/\/www.googleapis.com\/auth\/analytics.chatbot.read,https:\/\/www.googleapis.com\/auth\/analytics.readonly\"<\/span>\n<\/span><span class=\"cbb-line\">gcloud auth application-default set-quota-project <span class=\"cbb-string\">\"<\/span><span class=\"cbb-variable\">$PROJECT_ID<\/span><span class=\"cbb-string\">\"<\/span>\n<\/span><span class=\"cbb-line\">\n<\/span><span class=\"cbb-line\"><span class=\"cbb-function\">cat<\/span> <span class=\"cbb-operator\">&gt;<\/span> question.json &lt;&lt;<span class=\"cbb-string\">'JSON'<\/span>\n<\/span><span class=\"cbb-line\">{\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-string\">\"userQuery\"<\/span>: <span class=\"cbb-string\">\"For 2026-09-01 through 2026-09-07, report sessions by sessionDefaultChannelGroup. Use these exact dates and API field names. State any limitation and do not infer causes.\"<\/span>,\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-string\">\"returnPropertyQuota\"<\/span>: true\n<\/span><span class=\"cbb-line\">}\n<\/span><span class=\"cbb-line\">JSON\n<\/span><span class=\"cbb-line\">ACCESS_TOKEN=<span class=\"cbb-variable\">$(<\/span>gcloud auth application-default print-access-token)\n<\/span><span class=\"cbb-line\">&#91;&#91; <span class=\"cbb-attr\">-n<\/span> <span class=\"cbb-string\">\"<\/span><span class=\"cbb-variable\">$ACCESS_TOKEN<\/span><span class=\"cbb-string\">\"<\/span> &#93;&#93; <span class=\"cbb-operator\">||<\/span> { <span class=\"cbb-function\">echo<\/span> <span class=\"cbb-string\">\"Empty access token\"<\/span> <span class=\"cbb-operator\">&gt;<\/span>&amp;<span class=\"cbb-number\">2<\/span><span class=\"cbb-operator\">;<\/span> <span class=\"cbb-keyword\">exit<\/span> <span class=\"cbb-number\">1<\/span><span class=\"cbb-operator\">;<\/span> }\n<\/span><span class=\"cbb-line\"><span class=\"cbb-function\">curl<\/span> <span class=\"cbb-attr\">--fail-with-body<\/span> <span class=\"cbb-attr\">--silent<\/span> <span class=\"cbb-attr\">--show-error<\/span> \\\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-string\">\"https:\/\/analyticsdata.googleapis.com\/v1alpha\/properties\/<\/span><span class=\"cbb-variable\">${PROPERTY_ID}<\/span><span class=\"cbb-string\">:chat\"<\/span> \\\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">-H<\/span> <span class=\"cbb-string\">\"Authorization: Bearer <\/span><span class=\"cbb-variable\">${ACCESS_TOKEN}<\/span><span class=\"cbb-string\">\"<\/span> \\\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">-H<\/span> <span class=\"cbb-string\">\"x-goog-user-project: <\/span><span class=\"cbb-variable\">${PROJECT_ID}<\/span><span class=\"cbb-string\">\"<\/span> \\\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">-H<\/span> <span class=\"cbb-string\">\"Content-Type: application\/json\"<\/span> \\\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">--data-binary<\/span> @question.json <span class=\"cbb-attr\">-o<\/span> answer.json\n<\/span><span class=\"cbb-line\"><span class=\"cbb-function\">jq<\/span> <span class=\"cbb-string\">'{sessionId, blocks, propertyQuota}'<\/span> answer.json<\/span><\/code><\/pre><span class=\"cbb-status\" role=\"status\"><\/span><\/figure>\n\n\n<p>The response may contain text and tables. <code>answer.json<\/code> saves the complete response; <code>jq<\/code> displays selected fields. A missing table does not establish zero values. Table cells can contain currency or percentage signs, for example. A numeric comparison first requires the unit and meaning of each column. <a href=\"#source-2\">[2]<\/a><\/p>\n<h2>3. Ask a follow-up in the returned session<\/h2><p>The chat <code>sessionId<\/code> connects the next question to the conversation so far. This conversation identifier is unrelated to the <code>sessions<\/code> reporting metric. The next block stops if a nonempty identifier is missing. Further questions need the identifier from the latest response. Conversations for different properties or clients must remain separate.<\/p>\n\n<figure style=\"--cbb-digits:2\" class=\"cbb cbb--wrap cbb--numbers wp-block-code-beautifier-block-code\" data-lang=\"bash\"><figcaption class=\"cbb-head\"><span class=\"cbb-lang\">Shell<\/span><span class=\"cbb-actions\"><button type=\"button\" class=\"cbb-button cbb-button--wrap\" data-cbb-action=\"wrap\" aria-pressed=\"true\" title=\"Wrap long lines\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><path d=\"M2 4h12M2 8h9.5a2.5 2.5 0 0 1 0 5H8m0 0 1.5-1.5M8 13l1.5 1.5M2 12h3\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\/><\/svg><span class=\"cbb-sr\">Wrap long lines<\/span><\/button><button type=\"button\" class=\"cbb-button cbb-button--copy\" data-cbb-action=\"copy\" aria-label=\"Copy code\" data-cbb-status-done=\"Code copied to the clipboard.\" data-cbb-status-failed=\"Copying failed. The code is selected for copying with Ctrl+C or \u2318+C.\" data-cbb-status-noselect=\"Copying failed.\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><rect x=\"5.5\" y=\"5.5\" width=\"8\" height=\"8.5\" rx=\"1.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><path d=\"M10.5 3.5V3A1.5 1.5 0 0 0 9 1.5H4A1.5 1.5 0 0 0 2.5 3v6.5A1.5 1.5 0 0 0 4 11h.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><\/svg><span class=\"cbb-button-label\">Copy<\/span><\/button><\/span><\/figcaption><pre class=\"cbb-pre\" tabindex=\"0\" role=\"region\" aria-label=\"Code example: Shell\"><code class=\"cbb-code language-bash\" style=\"counter-reset:cbb-line 0;\"><span class=\"cbb-line\">SESSION_ID=<span class=\"cbb-variable\">$(<\/span><span class=\"cbb-function\">jq<\/span> <span class=\"cbb-attr\">-er<\/span> <span class=\"cbb-string\">'.sessionId | strings | select(length &gt; 0)'<\/span> answer.json)\n<\/span><span class=\"cbb-line\"><span class=\"cbb-function\">jq<\/span> <span class=\"cbb-attr\">-n<\/span> <span class=\"cbb-attr\">--arg<\/span> sid <span class=\"cbb-string\">\"<\/span><span class=\"cbb-variable\">$SESSION_ID<\/span><span class=\"cbb-string\">\"<\/span> <span class=\"cbb-string\">'{<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-string\">  sessionId: $sid,<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-string\">  userQuery: \"Compare those sessions by sessionDefaultChannelGroup with 2026-08-25 through 2026-08-31. Show both totals and absolute differences. Separate observations from hypotheses.\",<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-string\">  returnPropertyQuota: true<\/span>\n<\/span><span class=\"cbb-line\"><span class=\"cbb-string\">}'<\/span> <span class=\"cbb-operator\">&gt;<\/span> followup.json\n<\/span><span class=\"cbb-line\">ACCESS_TOKEN=<span class=\"cbb-variable\">$(<\/span>gcloud auth application-default print-access-token)\n<\/span><span class=\"cbb-line\">&#91;&#91; <span class=\"cbb-attr\">-n<\/span> <span class=\"cbb-string\">\"<\/span><span class=\"cbb-variable\">$ACCESS_TOKEN<\/span><span class=\"cbb-string\">\"<\/span> &#93;&#93; <span class=\"cbb-operator\">||<\/span> { <span class=\"cbb-function\">echo<\/span> <span class=\"cbb-string\">\"Empty access token\"<\/span> <span class=\"cbb-operator\">&gt;<\/span>&amp;<span class=\"cbb-number\">2<\/span><span class=\"cbb-operator\">;<\/span> <span class=\"cbb-keyword\">exit<\/span> <span class=\"cbb-number\">1<\/span><span class=\"cbb-operator\">;<\/span> }\n<\/span><span class=\"cbb-line\"><span class=\"cbb-function\">curl<\/span> <span class=\"cbb-attr\">--fail-with-body<\/span> <span class=\"cbb-attr\">--silent<\/span> <span class=\"cbb-attr\">--show-error<\/span> \\\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-string\">\"https:\/\/analyticsdata.googleapis.com\/v1alpha\/properties\/<\/span><span class=\"cbb-variable\">${PROPERTY_ID}<\/span><span class=\"cbb-string\">:chat\"<\/span> \\\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">-H<\/span> <span class=\"cbb-string\">\"Authorization: Bearer <\/span><span class=\"cbb-variable\">${ACCESS_TOKEN}<\/span><span class=\"cbb-string\">\"<\/span> \\\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">-H<\/span> <span class=\"cbb-string\">\"x-goog-user-project: <\/span><span class=\"cbb-variable\">${PROJECT_ID}<\/span><span class=\"cbb-string\">\"<\/span> \\\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">-H<\/span> <span class=\"cbb-string\">\"Content-Type: application\/json\"<\/span> \\\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">--data-binary<\/span> @followup.json <span class=\"cbb-attr\">-o<\/span> followup-answer.json\n<\/span><span class=\"cbb-line\"><span class=\"cbb-function\">jq<\/span> <span class=\"cbb-string\">'{sessionId, blocks, propertyQuota}'<\/span> followup-answer.json<\/span><\/code><\/pre><span class=\"cbb-status\" role=\"status\"><\/span><\/figure>\n\n\n<p>The follow-up explicitly names the earlier period. \u201cOrganic Search declined\u201d describes an observation. \u201cThe new landing page caused the decline\u201d remains a hypothesis without further evidence. The saved questions show what was actually requested.<\/p>\n<h2>4. Reproduce the count with runReport<\/h2><p>After the two chat calls, the third request uses <code>runReport<\/code> to retrieve the same metric by the same channels for both weeks. The comparison therefore uses an explicitly defined report. Both results still come from GA4: agreement proves neither complete data collection nor the cause of a change. <a href=\"#source-3\">[3]<\/a><\/p>\n\n<figure style=\"--cbb-digits:2\" class=\"cbb cbb--wrap cbb--numbers wp-block-code-beautifier-block-code\" data-lang=\"bash\"><figcaption class=\"cbb-head\"><span class=\"cbb-lang\">Shell<\/span><span class=\"cbb-actions\"><button type=\"button\" class=\"cbb-button cbb-button--wrap\" data-cbb-action=\"wrap\" aria-pressed=\"true\" title=\"Wrap long lines\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><path d=\"M2 4h12M2 8h9.5a2.5 2.5 0 0 1 0 5H8m0 0 1.5-1.5M8 13l1.5 1.5M2 12h3\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"\/><\/svg><span class=\"cbb-sr\">Wrap long lines<\/span><\/button><button type=\"button\" class=\"cbb-button cbb-button--copy\" data-cbb-action=\"copy\" aria-label=\"Copy code\" data-cbb-status-done=\"Code copied to the clipboard.\" data-cbb-status-failed=\"Copying failed. The code is selected for copying with Ctrl+C or \u2318+C.\" data-cbb-status-noselect=\"Copying failed.\"><svg aria-hidden=\"true\" focusable=\"false\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"><rect x=\"5.5\" y=\"5.5\" width=\"8\" height=\"8.5\" rx=\"1.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><path d=\"M10.5 3.5V3A1.5 1.5 0 0 0 9 1.5H4A1.5 1.5 0 0 0 2.5 3v6.5A1.5 1.5 0 0 0 4 11h.5\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"\/><\/svg><span class=\"cbb-button-label\">Copy<\/span><\/button><\/span><\/figcaption><pre class=\"cbb-pre\" tabindex=\"0\" role=\"region\" aria-label=\"Code example: Shell\"><code class=\"cbb-code language-bash\" style=\"counter-reset:cbb-line 0;\"><span class=\"cbb-line\"><span class=\"cbb-function\">cat<\/span> <span class=\"cbb-operator\">&gt;<\/span> report-request.json &lt;&lt;<span class=\"cbb-string\">'JSON'<\/span>\n<\/span><span class=\"cbb-line\">{\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-string\">\"dateRanges\"<\/span>: &#91;\n<\/span><span class=\"cbb-line\">    {<span class=\"cbb-string\">\"startDate\"<\/span>:<span class=\"cbb-string\">\"2026-09-01\"<\/span>,<span class=\"cbb-string\">\"endDate\"<\/span>:<span class=\"cbb-string\">\"2026-09-07\"<\/span>,<span class=\"cbb-string\">\"name\"<\/span>:<span class=\"cbb-string\">\"current\"<\/span>},\n<\/span><span class=\"cbb-line\">    {<span class=\"cbb-string\">\"startDate\"<\/span>:<span class=\"cbb-string\">\"2026-08-25\"<\/span>,<span class=\"cbb-string\">\"endDate\"<\/span>:<span class=\"cbb-string\">\"2026-08-31\"<\/span>,<span class=\"cbb-string\">\"name\"<\/span>:<span class=\"cbb-string\">\"previous\"<\/span>}\n<\/span><span class=\"cbb-line\">  &#93;,\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-string\">\"dimensions\"<\/span>: &#91;{<span class=\"cbb-string\">\"name\"<\/span>:<span class=\"cbb-string\">\"sessionDefaultChannelGroup\"<\/span>}&#93;,\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-string\">\"metrics\"<\/span>: &#91;{<span class=\"cbb-string\">\"name\"<\/span>:<span class=\"cbb-string\">\"sessions\"<\/span>}&#93;,\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-string\">\"limit\"<\/span>: <span class=\"cbb-string\">\"1000\"<\/span>,\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-string\">\"returnPropertyQuota\"<\/span>: true\n<\/span><span class=\"cbb-line\">}\n<\/span><span class=\"cbb-line\">JSON\n<\/span><span class=\"cbb-line\">ACCESS_TOKEN=<span class=\"cbb-variable\">$(<\/span>gcloud auth application-default print-access-token)\n<\/span><span class=\"cbb-line\">&#91;&#91; <span class=\"cbb-attr\">-n<\/span> <span class=\"cbb-string\">\"<\/span><span class=\"cbb-variable\">$ACCESS_TOKEN<\/span><span class=\"cbb-string\">\"<\/span> &#93;&#93; <span class=\"cbb-operator\">||<\/span> { <span class=\"cbb-function\">echo<\/span> <span class=\"cbb-string\">\"Empty access token\"<\/span> <span class=\"cbb-operator\">&gt;<\/span>&amp;<span class=\"cbb-number\">2<\/span><span class=\"cbb-operator\">;<\/span> <span class=\"cbb-keyword\">exit<\/span> <span class=\"cbb-number\">1<\/span><span class=\"cbb-operator\">;<\/span> }\n<\/span><span class=\"cbb-line\"><span class=\"cbb-function\">curl<\/span> <span class=\"cbb-attr\">--fail-with-body<\/span> <span class=\"cbb-attr\">--silent<\/span> <span class=\"cbb-attr\">--show-error<\/span> \\\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-string\">\"https:\/\/analyticsdata.googleapis.com\/v1beta\/properties\/<\/span><span class=\"cbb-variable\">${PROPERTY_ID}<\/span><span class=\"cbb-string\">:runReport\"<\/span> \\\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">-H<\/span> <span class=\"cbb-string\">\"Authorization: Bearer <\/span><span class=\"cbb-variable\">${ACCESS_TOKEN}<\/span><span class=\"cbb-string\">\"<\/span> \\\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">-H<\/span> <span class=\"cbb-string\">\"x-goog-user-project: <\/span><span class=\"cbb-variable\">${PROJECT_ID}<\/span><span class=\"cbb-string\">\"<\/span> \\\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">-H<\/span> <span class=\"cbb-string\">\"Content-Type: application\/json\"<\/span> \\\n<\/span><span class=\"cbb-line\">  <span class=\"cbb-attr\">--data-binary<\/span> @report-request.json <span class=\"cbb-attr\">-o<\/span> report-response.json\n<\/span><span class=\"cbb-line\"><span class=\"cbb-function\">jq<\/span> <span class=\"cbb-string\">'{dimensionHeaders,metricHeaders,rows,rowCount,metadata,propertyQuota}'<\/span> report-response.json<\/span><\/code><\/pre><span class=\"cbb-status\" role=\"status\"><\/span><\/figure>\n\n\n<p>Column names appear in <code>dimensionHeaders<\/code> and <code>metricHeaders<\/code>; row values follow that order. The additional <code>dateRange<\/code> column contains <code>current<\/code> or <code>previous<\/code> here. Comparison therefore uses the channel and period together, not row position. For example, 100 sessions instead of 80 means 20 additional sessions and a 25 percent increase. That percentage calculation is undefined when the earlier value is zero. A missing row cannot be treated as a measured zero without further checks.<\/p>\n\n\n<!-- lw-dia-neu 20609 -->\n<figure class=\"lw-diagram\"><img decoding=\"async\" src=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/diagrams\/neu-20261115\/ga4-advisor-api-runreport-en.png?v=20261116\" alt=\"Four numbered steps: a first question to properties.chat in v1alpha saved as answer.json, a follow-up with the same chat sessionId, a runReport request for the same metric, channels and weeks matched by channel and dateRange, then a check of thresholds, sampling and rowCount.\" width=\"1600\" height=\"900\" loading=\"lazy\"><figcaption>runReport requests the same metric again, so each channel value from the chat can be checked.<\/figcaption><\/figure>\n<!-- lw-flux-illu 20609-a4 -->\n<figure class=\"lw-illu\"><img src=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/illustrationen\/flux-20609-a4.webp\" width=\"1120\" height=\"630\" loading=\"lazy\" decoding=\"async\" alt=\"Two identical scales weigh the same loaf and reach the same result. In the same way, runReport requests the same metric for the same channels and weeks once more, so the number from the chat can be checked.\"><figcaption>Two identical scales weigh the same loaf and reach the same result. In the same way, runReport requests the same metric for the same channels and weeks once more, so the number from the chat can be checked.<\/figcaption><\/figure>\n\n\n<h2>5. Inspect limitations before using the result<\/h2><p>The <a href=\"https:\/\/www.lukaswojcik.com\/blog\/en\/toolbox\/ga4-api-response-inspector\/\">GA4 API Response Inspector<\/a> is a supplementary tool for saved report responses. Checking the chat numbers remains a separate step. The <code>metadata<\/code> in <code>report-response.json<\/code> also needs review: thresholds can hide small groups, while sampling can base calculations on only part of the events. If <code>rowCount<\/code> exceeds the number of returned rows, more results remain. This example requests at most 1,000 rows and does not fetch further pages automatically. <a href=\"#source-8\">[8]<\/a><\/p><p><code>returnPropertyQuota<\/code> requests information about quota, meaning API usage limits. The setting does not reserve more calls. Missing quota details leave the available allowance unknown. Before retrying, the cause needs checking: sign-in failure, insufficient permission or a usage limit. Further chat calls can consume more quota and return different answers. <a href=\"#source-1\">[1]<\/a><\/p>\n<h2>6. Keep the output reviewable<\/h2><p>The test record consists of two questions, two chat responses, the report request, the report response and the retrieval time. Access to these files should be limited to authorized people. Google\u2019s privacy notice says human reviewers may process conversations to improve the product. Customer names and confidential campaign plans are unnecessary for this numerical question. <a href=\"#source-5\">[5]<\/a><\/p><p>The result records whether each channel\u2019s chat value matches the report. Any mismatch retains both values and the unresolved questions. \u201cNot reproducible\u201d is also a useful result. The week-to-week comparison alone does not support a recommendation to change advertising spend.<\/p><div class=\"lw-faq\">\n<h2>Questions and answers<\/h2>\n\n<h3>Why does the sign-in need its own Desktop app OAuth client?<\/h3>\n<p>The two Analytics permissions, analytics.chatbot.read and analytics.readonly, fall outside the usual Cloud set that gcloud requests with its built-in client. For permissions of this kind, Google documents the use of a separate client whose JSON file is passed with <code>--client-id-file<\/code>. If either permission is missing from the access token, the API rejects the corresponding call.<\/p>\n\n<h3>The chat response gives a different number for a channel than runReport. What can explain the gap?<\/h3>\n<p>Before the difference is attributed to the assistant, the surrounding conditions are worth comparing. Common causes:<\/p>\n<ol>\n<li>Date range and time zone. runReport works with the specified dates in the property\u2019s reporting time zone. Whether the chat response used exactly the same days can only be seen in its own text or table.<\/li>\n<li>Metric and grouping. A column may contain a different metric or a different channel grouping than sessions by sessionDefaultChannelGroup, so the unit and meaning of every column need to be clear.<\/li>\n<li>Thresholds and sampling. The metadata in report-response.json shows whether small groups were hidden or only part of the events went into the calculation. The chat response needs a separate check for comparable notes.<\/li>\n<li>Missing rows. A channel absent from one of the two responses is not a measured zero.<\/li>\n<li>Retrieval time. If chat and report were retrieved at different times and the range covers very recent days, ongoing GA4 processing can still change the data in between.<\/li>\n<\/ol>\n<p>If none of these causes can be confirmed, both values stay in the record. \u201cNot reproducible\u201d is a valid result too; a single case says nothing about the reliability of later responses.<\/p>\n\n<h3>Can the same workflow be used in turn for several properties belonging to different clients?<\/h3>\n<p>Yes, with separate folders and separate conversations. Conversations for different properties must not be mixed, so each property starts its own conversation without a sessionId. A dedicated working folder per property and run also prevents answer.json or report-response.json from overwriting an earlier state.<\/p>\n<p>Two operational points remain. The signed-in account needs access to each individual property, and every new chat call can consume further quota; the figures returned through returnPropertyQuota apply to the property queried. And because Google\u2019s privacy notice says human reviewers may process conversations, client names and confidential plans do not belong in the questions, and access to the saved files should be limited to authorized people.<\/p>\n<\/div>\n\n<div class=\"lw-quellen\"><h2>Sources<\/h2><ol><li id=\"source-1\"><a href=\"https:\/\/developers.google.com\/analytics\/devguides\/reporting\/data\/v1\/advisor-basics\" target=\"_blank\" rel=\"noopener noreferrer\">Analytics Advisor API guide<\/a><\/li><li id=\"source-2\"><a href=\"https:\/\/developers.google.com\/analytics\/devguides\/reporting\/data\/v1\/rest\/v1alpha\/properties\/chat\" target=\"_blank\" rel=\"noopener noreferrer\">properties.chat reference<\/a><\/li><li id=\"source-3\"><a href=\"https:\/\/developers.google.com\/analytics\/devguides\/reporting\/data\/v1\/rest\/v1beta\/properties\/runReport\" target=\"_blank\" rel=\"noopener noreferrer\">properties.runReport reference<\/a><\/li><li id=\"source-4\"><a href=\"https:\/\/developers.google.com\/analytics\/devguides\/reporting\/data\/v1\/api-schema\" target=\"_blank\" rel=\"noopener noreferrer\">Data API schema<\/a><\/li><li id=\"source-5\"><a href=\"https:\/\/support.google.com\/helpguide\/answer\/14185196\" target=\"_blank\" rel=\"noopener noreferrer\">Chat AI Privacy Hub<\/a><\/li><li id=\"source-6\"><a href=\"https:\/\/docs.cloud.google.com\/sdk\/gcloud\/reference\/auth\/application-default\/login\" target=\"_blank\" rel=\"noopener noreferrer\">Google Cloud CLI: gcloud auth application-default login<\/a><\/li><li id=\"source-7\"><a href=\"https:\/\/developers.google.com\/analytics\/devguides\/reporting\/data\/v1\/rest\/v1beta\/DateRange\" target=\"_blank\" rel=\"noopener noreferrer\">Google Analytics: DateRange<\/a><\/li><li id=\"source-8\"><a href=\"https:\/\/developers.google.com\/analytics\/devguides\/reporting\/data\/v1\/rest\/v1beta\/ResponseMetaData\" target=\"_blank\" rel=\"noopener noreferrer\">Google Analytics: ResponseMetaData<\/a><\/li><\/ol><\/div>","protected":false},"excerpt":{"rendered":"<p>Two chat questions compare sessions by channel across two weeks. A separate GA4 report checks the numbers; the example explains missing rows, usage limits and the difference between observations and causes.<\/p>\n","protected":false},"author":1,"featured_media":29878,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-20609","post","type-post","status-publish","format-standard","hentry","category-digital-analytics"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Tutorial: Querying GA4 Analytics Advisor via API and Checking the Answer with runReport | Lukas Wojcik<\/title>\n<meta name=\"description\" content=\"A reproducible channel comparison with properties.chat, session context, quota information and a separate runReport check.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tutorial: Querying GA4 Analytics Advisor via API and Checking the Answer with runReport | Lukas Wojcik\" \/>\n<meta property=\"og:description\" content=\"A reproducible channel comparison with properties.chat, session context, quota information and a separate runReport check.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/\" \/>\n<meta property=\"og:site_name\" content=\"Lukas Wojcik - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-27T09:58:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-16T02:37:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll-20609-20609.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Lukas Wojcik\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lukas Wojcik\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\\\/\"},\"author\":{\"name\":\"Lukas Wojcik\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"headline\":\"Tutorial: Querying GA4 Analytics Advisor via API and Checking the Answer with runReport\",\"datePublished\":\"2026-09-27T09:58:58+00:00\",\"dateModified\":\"2026-11-16T02:37:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\\\/\"},\"wordCount\":1397,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/flux-voll-20609-20609.png\",\"articleSection\":[\"Digital Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\\\/\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\\\/\",\"name\":\"Tutorial: Querying GA4 Analytics Advisor via API and Checking the Answer with runReport | Lukas Wojcik\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/flux-voll-20609-20609.png\",\"datePublished\":\"2026-09-27T09:58:58+00:00\",\"dateModified\":\"2026-11-16T02:37:36+00:00\",\"description\":\"A reproducible channel comparison with properties.chat, session context, quota information and a separate runReport check.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/flux-voll-20609-20609.png\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/flux-voll-20609-20609.png\",\"width\":1200,\"height\":630,\"caption\":\"Tutorial: Querying GA4 Analytics Advisor via API and Checking the Answer with runReport\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/digital-analytics\\\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/de\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tutorial: Querying GA4 Analytics Advisor via API and Checking the Answer with runReport\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\",\"name\":\"Lukas Wojcik - Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\",\"name\":\"Lukas Wojcik\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"width\":424,\"height\":636,\"caption\":\"Lukas Wojcik\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\"},\"sameAs\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Tutorial: Querying GA4 Analytics Advisor via API and Checking the Answer with runReport | Lukas Wojcik","description":"A reproducible channel comparison with properties.chat, session context, quota information and a separate runReport check.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/","og_locale":"en_US","og_type":"article","og_title":"Tutorial: Querying GA4 Analytics Advisor via API and Checking the Answer with runReport | Lukas Wojcik","og_description":"A reproducible channel comparison with properties.chat, session context, quota information and a separate runReport check.","og_url":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/","og_site_name":"Lukas Wojcik - Blog","article_published_time":"2026-09-27T09:58:58+00:00","article_modified_time":"2026-11-16T02:37:36+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll-20609-20609.png","type":"image\/png"}],"author":"Lukas Wojcik","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Lukas Wojcik","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/#article","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/"},"author":{"name":"Lukas Wojcik","@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"headline":"Tutorial: Querying GA4 Analytics Advisor via API and Checking the Answer with runReport","datePublished":"2026-09-27T09:58:58+00:00","dateModified":"2026-11-16T02:37:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/"},"wordCount":1397,"commentCount":0,"publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll-20609-20609.png","articleSection":["Digital Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/","url":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/","name":"Tutorial: Querying GA4 Analytics Advisor via API and Checking the Answer with runReport | Lukas Wojcik","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/#primaryimage"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll-20609-20609.png","datePublished":"2026-09-27T09:58:58+00:00","dateModified":"2026-11-16T02:37:36+00:00","description":"A reproducible channel comparison with properties.chat, session context, quota information and a separate runReport check.","breadcrumb":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/#primaryimage","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll-20609-20609.png","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/11\/flux-voll-20609-20609.png","width":1200,"height":630,"caption":"Tutorial: Querying GA4 Analytics Advisor via API and Checking the Answer with runReport"},{"@type":"BreadcrumbList","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/digital-analytics\/tutorial-querying-ga4-analytics-advisor-via-api-and-checking-the-answer-with-runreport\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.lukaswojcik.com\/blog\/de\/"},{"@type":"ListItem","position":2,"name":"Tutorial: Querying GA4 Analytics Advisor via API and Checking the Answer with runReport"}]},{"@type":"WebSite","@id":"https:\/\/www.lukaswojcik.com\/blog\/#website","url":"https:\/\/www.lukaswojcik.com\/blog\/","name":"Lukas Wojcik - Blog","description":"","publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.lukaswojcik.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9","name":"Lukas Wojcik","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","width":424,"height":636,"caption":"Lukas Wojcik"},"logo":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg"},"sameAs":["https:\/\/www.lukaswojcik.com\/blog"]}]}},"_links":{"self":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/20609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/comments?post=20609"}],"version-history":[{"count":4,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/20609\/revisions"}],"predecessor-version":[{"id":25782,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/20609\/revisions\/25782"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media\/29878"}],"wp:attachment":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media?parent=20609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/categories?post=20609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/tags?post=20609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}