[{"data":1,"prerenderedAt":6487},["ShallowReactive",2],{"blog-en-new-data-api-for-google-analytics-4":3,"related-en-new-data-api-for-google-analytics-4":4262},{"id":4,"title":5,"author":6,"body":7,"category":6,"description":4243,"extension":4244,"image":4245,"isToc":4246,"langAlt":6,"meta":4247,"metaDescription":4248,"navigation":4249,"path":4250,"published":4249,"publishedAt":4251,"readingTimeMinutes":4252,"readingTimeText":4253,"relatedArticles":4254,"seo":4257,"stem":4258,"teaser":4259,"updatedAtCustom":4260,"__hash__":4261},"blog_en\u002Fen\u002Fblog\u002Fnew-data-api-for-google-analytics-4.md","New Data API for Google Analytics 4",null,{"type":8,"value":9,"toc":4227},"minimark",[10,27,39,49,60,63,68,80,87,90,134,139,425,430,681,685,688,729,734,1200,1205,1715,1718,1722,1726,1729,1756,1961,1965,1972,1993,1996,2021,2479,2508,2512,2527,2530,2533,2540,3074,3083,3087,3101,3106,3109,3114,3118,3128,3131,3486,3490,3506,3509,3512,3536,3800,3868,3874,3878,3881,3892,3919,3926,3935,3944,3952,4183,4187,4190,4217,4223],[11,12,13,14,18,19,22,23,26],"p",{},"The ",[15,16,17],"strong",{},"new version of Google Analytics"," with an innovative approach to data structure has been introduced in summer 2019, under the name Google Analytics App + Web. In autumn 2020 Google released it from the beta version and rebranded it as ",[15,20,21],{},"Google Analytics 4",". While it is still not recommended to transfer your whole data measurement to the new version as it is being gradually improved, it definitely deserves increased attention as Google is introducing many new features there. The new Google Analytics 4 is based on events and their parameters. As its previous name implies, it combines data from apps and web analytics in one property. Moreover, it serves as a flexible tool ",[15,24,25],{},"for cross-platform analysis",". To learn more about Google Analytics 4, follow our blog for an upcoming article in which we will discuss changes and new features of the GA4, extensively.",[28,29,30,31,38],"note",{},"\nThis article describes the use of Data API for the new version of Google Analytics, GA4. If you are interested in the GA Reporting API V4 used for the Universal Google Analytics, check out \n",[32,33,37],"a",{"href":34,"rel":35},"https:\u002F\u002Fcrossmasters.com\u002Fen\u002Fblog\u002Fnotes-on-new-features-of-google-analytics-reporting-api-v4\u002F",[36],"nofollow","the article dedicated to UA API","\n.\n",[11,40,41,42,48],{},"In this article, we speak about approaches to query data from Google Analytics 4 using the Google Analytics Data API (further abbreviated as GA4 API). The GA4 API is still available only in the ",[15,43,44],{},[45,46,47],"em",{},"beta version"," but it is never too early to study its features and learn how to benefit from them. We present the API mainly using examples of the JSON-structured request body that can be used in a cURL, HTTP request, or in JavaScript. At the end of the article, you will find a sample code to run a query in Python using the library google-analytics-data prepared directly from Google.",[50,51,52,53,59],"tip",{},"\nFor testing queries to the GA4 API you can also use the \n",[32,54,58],{"href":55,"rel":56,"title":57},"https:\u002F\u002Fwaaila.com\u002F",[36],"Waaila","WAAILA","\n application. WAAILA is a comprehensive tool for data quality control that allows you to access data from multiple analytical data providers, including Google Analytics 4. The extracted data can be further evaluated in WAAILA using pre-built or custom tests to monitor measurement quality and recognize potential data issues in time.\n",[11,61,62],{},"Remember that this article is only about the Data API, which means the API for querying the measured information about your sites. Google is also introducing a new Admin API for displaying and changing the settings of Google Analytics. We will investigate that in a future article.",[64,65,67],"h2",{"id":66},"one-simple-query-querying-data-using-runreport-method","One simple query - querying data using runReport method",[11,69,70,71,74,75,79],{},"The easiest way to extract data is using the ",[15,72,73],{},"runReport"," method which allows running a single request to data in order to receive a single set of results. To obtain data a POST request is sent to URL ",[32,76,77],{"href":77,"rel":78},"https:\u002F\u002Fanalyticsdata.googleapis.com\u002Fv1beta\u002F",[36],"\u003CGA4_PROPERTY_ID>:runReport where you need to replace the placeholder \u003CGA4_PROPERTY_ID> with your GA 4 property ID. The basic parameters of a single query have a very similar structure to queries constructed for the Universal Analytics API (further denoted as original API). Therefore, if you are now using the original API with the basic functionality of the API queries, there will be only minor adjustments needed. Bigger differences to the original API lie in its further options and extensions, for example, quotas report or a special request for pivot data. These will be presented in further sections of the article.",[81,82,84],"h3",{"id":83},"differences-between-data-queries",[15,85,86],{},"Differences between data queries",[11,88,89],{},"To illustrate the similarities and differences we show an example of a simple query of sessions over 3 days. This query gives you information about how your sessions have evolved in the last three days. Below we include the request body for both the GA4 API and the original API. As you can see below, there are some differences between the queries.",[91,92,93,97,116],"ol",{},[94,95,96],"li",{},"The easiest noticeable difference is that there is no parameter with view ID or property ID in the query. This information is passed directly into the request url (as mentioned above).",[94,98,99,100,103,104,108,109,112,113,115],{},"The GA4 API introduced ",[15,101,102],{},"consistency"," between specifying dimensions’ and metrics’ names because names of both metrics and dimensions are specified in parameter ",[105,106,107],"code",{},"name",", not ",[105,110,111],{},"expression"," for metrics and ",[105,114,107],{}," for dimensions as before.",[94,117,118,119,122,123,126,127,129,130,133],{},"Lastly, the ",[105,120,121],{},"orderBys"," has a slightly different structure, where you ",[15,124,125],{},"differentiate"," if you order by ",[15,128,32],{}," ",[15,131,132],{},"dimension, a metric, or a pivot group"," and you specify the direction of ordering for all listed columns together.",[11,135,136],{},[45,137,138],{},"The query for GA4 example",[140,141,146],"pre",{"className":142,"code":143,"language":144,"meta":145,"style":145},"language-json shiki shiki-themes material-theme-ocean","{\n  \"dateRanges\": [\n    {\n      \"startDate\": \"2021-01-04\",\n      \"endDate\": \"2021-01-06\"\n    }\n  ],\n  \"metrics\": [\n    {\n      \"name\": \"sessions\"\n    }\n  ],\n  \"dimensions\": [\n    {\n      \"name\": \"date\"\n    }\n  ],\n  \"orderBys\": [\n    {\n      \"metric\": {\n        \"metricName\": \"sessions\"\n      },\n      \"desc\": true\n    }\n  ]\n}\n","json","",[105,147,148,157,176,182,208,228,234,240,254,259,277,282,287,301,306,324,329,334,347,352,367,387,393,408,413,419],{"__ignoreMap":145},[149,150,153],"span",{"class":151,"line":152},"line",1,[149,154,156],{"class":155},"sAklC","{\n",[149,158,160,163,167,170,173],{"class":151,"line":159},2,[149,161,162],{"class":155},"  \"",[149,164,166],{"class":165},"sJ14y","dateRanges",[149,168,169],{"class":155},"\"",[149,171,172],{"class":155},":",[149,174,175],{"class":155}," [\n",[149,177,179],{"class":151,"line":178},3,[149,180,181],{"class":155},"    {\n",[149,183,185,188,192,194,196,199,203,205],{"class":151,"line":184},4,[149,186,187],{"class":155},"      \"",[149,189,191],{"class":190},"s5Dmg","startDate",[149,193,169],{"class":155},[149,195,172],{"class":155},[149,197,198],{"class":155}," \"",[149,200,202],{"class":201},"sfyAc","2021-01-04",[149,204,169],{"class":155},[149,206,207],{"class":155},",\n",[149,209,211,213,216,218,220,222,225],{"class":151,"line":210},5,[149,212,187],{"class":155},[149,214,215],{"class":190},"endDate",[149,217,169],{"class":155},[149,219,172],{"class":155},[149,221,198],{"class":155},[149,223,224],{"class":201},"2021-01-06",[149,226,227],{"class":155},"\"\n",[149,229,231],{"class":151,"line":230},6,[149,232,233],{"class":155},"    }\n",[149,235,237],{"class":151,"line":236},7,[149,238,239],{"class":155},"  ],\n",[149,241,243,245,248,250,252],{"class":151,"line":242},8,[149,244,162],{"class":155},[149,246,247],{"class":165},"metrics",[149,249,169],{"class":155},[149,251,172],{"class":155},[149,253,175],{"class":155},[149,255,257],{"class":151,"line":256},9,[149,258,181],{"class":155},[149,260,262,264,266,268,270,272,275],{"class":151,"line":261},10,[149,263,187],{"class":155},[149,265,107],{"class":190},[149,267,169],{"class":155},[149,269,172],{"class":155},[149,271,198],{"class":155},[149,273,274],{"class":201},"sessions",[149,276,227],{"class":155},[149,278,280],{"class":151,"line":279},11,[149,281,233],{"class":155},[149,283,285],{"class":151,"line":284},12,[149,286,239],{"class":155},[149,288,290,292,295,297,299],{"class":151,"line":289},13,[149,291,162],{"class":155},[149,293,294],{"class":165},"dimensions",[149,296,169],{"class":155},[149,298,172],{"class":155},[149,300,175],{"class":155},[149,302,304],{"class":151,"line":303},14,[149,305,181],{"class":155},[149,307,309,311,313,315,317,319,322],{"class":151,"line":308},15,[149,310,187],{"class":155},[149,312,107],{"class":190},[149,314,169],{"class":155},[149,316,172],{"class":155},[149,318,198],{"class":155},[149,320,321],{"class":201},"date",[149,323,227],{"class":155},[149,325,327],{"class":151,"line":326},16,[149,328,233],{"class":155},[149,330,332],{"class":151,"line":331},17,[149,333,239],{"class":155},[149,335,337,339,341,343,345],{"class":151,"line":336},18,[149,338,162],{"class":155},[149,340,121],{"class":165},[149,342,169],{"class":155},[149,344,172],{"class":155},[149,346,175],{"class":155},[149,348,350],{"class":151,"line":349},19,[149,351,181],{"class":155},[149,353,355,357,360,362,364],{"class":151,"line":354},20,[149,356,187],{"class":155},[149,358,359],{"class":190},"metric",[149,361,169],{"class":155},[149,363,172],{"class":155},[149,365,366],{"class":155}," {\n",[149,368,370,373,377,379,381,383,385],{"class":151,"line":369},21,[149,371,372],{"class":155},"        \"",[149,374,376],{"class":375},"sx098","metricName",[149,378,169],{"class":155},[149,380,172],{"class":155},[149,382,198],{"class":155},[149,384,274],{"class":201},[149,386,227],{"class":155},[149,388,390],{"class":151,"line":389},22,[149,391,392],{"class":155},"      },\n",[149,394,396,398,401,403,405],{"class":151,"line":395},23,[149,397,187],{"class":155},[149,399,400],{"class":190},"desc",[149,402,169],{"class":155},[149,404,172],{"class":155},[149,406,407],{"class":155}," true\n",[149,409,411],{"class":151,"line":410},24,[149,412,233],{"class":155},[149,414,416],{"class":151,"line":415},25,[149,417,418],{"class":155},"  ]\n",[149,420,422],{"class":151,"line":421},26,[149,423,424],{"class":155},"}\n",[11,426,427],{},[45,428,429],{},"The query for UA for comparison",[140,431,433],{"className":142,"code":432,"language":144,"meta":145,"style":145},"{\n  \"viewId\": \"XXXXXXXXX\",\n  \"dateRanges\": [\n    {\n      \"startDate\": \"2021-01-04\",\n      \"endDate\": \"2021-01-06\"\n    }\n  ],\n  \"metrics\": [\n    {\n      \"expression\": \"ga:sessions\",\n      \"alias\": \"\"\n    }\n  ],\n  \"dimensions\": [\n    {\n      \"name\": \"ga:date\"\n    }\n  ],\n  \"orderBys\": [\n    {\n      \"sortOrder\": \"DESCENDING\",\n      \"fieldName\": \"ga:users\"\n    }\n  ]\n}\n",[105,434,435,439,459,471,475,493,509,513,517,529,533,552,566,570,574,586,590,607,611,615,627,631,651,669,673,677],{"__ignoreMap":145},[149,436,437],{"class":151,"line":152},[149,438,156],{"class":155},[149,440,441,443,446,448,450,452,455,457],{"class":151,"line":159},[149,442,162],{"class":155},[149,444,445],{"class":165},"viewId",[149,447,169],{"class":155},[149,449,172],{"class":155},[149,451,198],{"class":155},[149,453,454],{"class":201},"XXXXXXXXX",[149,456,169],{"class":155},[149,458,207],{"class":155},[149,460,461,463,465,467,469],{"class":151,"line":178},[149,462,162],{"class":155},[149,464,166],{"class":165},[149,466,169],{"class":155},[149,468,172],{"class":155},[149,470,175],{"class":155},[149,472,473],{"class":151,"line":184},[149,474,181],{"class":155},[149,476,477,479,481,483,485,487,489,491],{"class":151,"line":210},[149,478,187],{"class":155},[149,480,191],{"class":190},[149,482,169],{"class":155},[149,484,172],{"class":155},[149,486,198],{"class":155},[149,488,202],{"class":201},[149,490,169],{"class":155},[149,492,207],{"class":155},[149,494,495,497,499,501,503,505,507],{"class":151,"line":230},[149,496,187],{"class":155},[149,498,215],{"class":190},[149,500,169],{"class":155},[149,502,172],{"class":155},[149,504,198],{"class":155},[149,506,224],{"class":201},[149,508,227],{"class":155},[149,510,511],{"class":151,"line":236},[149,512,233],{"class":155},[149,514,515],{"class":151,"line":242},[149,516,239],{"class":155},[149,518,519,521,523,525,527],{"class":151,"line":256},[149,520,162],{"class":155},[149,522,247],{"class":165},[149,524,169],{"class":155},[149,526,172],{"class":155},[149,528,175],{"class":155},[149,530,531],{"class":151,"line":261},[149,532,181],{"class":155},[149,534,535,537,539,541,543,545,548,550],{"class":151,"line":279},[149,536,187],{"class":155},[149,538,111],{"class":190},[149,540,169],{"class":155},[149,542,172],{"class":155},[149,544,198],{"class":155},[149,546,547],{"class":201},"ga:sessions",[149,549,169],{"class":155},[149,551,207],{"class":155},[149,553,554,556,559,561,563],{"class":151,"line":284},[149,555,187],{"class":155},[149,557,558],{"class":190},"alias",[149,560,169],{"class":155},[149,562,172],{"class":155},[149,564,565],{"class":155}," \"\"\n",[149,567,568],{"class":151,"line":289},[149,569,233],{"class":155},[149,571,572],{"class":151,"line":303},[149,573,239],{"class":155},[149,575,576,578,580,582,584],{"class":151,"line":308},[149,577,162],{"class":155},[149,579,294],{"class":165},[149,581,169],{"class":155},[149,583,172],{"class":155},[149,585,175],{"class":155},[149,587,588],{"class":151,"line":326},[149,589,181],{"class":155},[149,591,592,594,596,598,600,602,605],{"class":151,"line":331},[149,593,187],{"class":155},[149,595,107],{"class":190},[149,597,169],{"class":155},[149,599,172],{"class":155},[149,601,198],{"class":155},[149,603,604],{"class":201},"ga:date",[149,606,227],{"class":155},[149,608,609],{"class":151,"line":336},[149,610,233],{"class":155},[149,612,613],{"class":151,"line":349},[149,614,239],{"class":155},[149,616,617,619,621,623,625],{"class":151,"line":354},[149,618,162],{"class":155},[149,620,121],{"class":165},[149,622,169],{"class":155},[149,624,172],{"class":155},[149,626,175],{"class":155},[149,628,629],{"class":151,"line":369},[149,630,181],{"class":155},[149,632,633,635,638,640,642,644,647,649],{"class":151,"line":389},[149,634,187],{"class":155},[149,636,637],{"class":190},"sortOrder",[149,639,169],{"class":155},[149,641,172],{"class":155},[149,643,198],{"class":155},[149,645,646],{"class":201},"DESCENDING",[149,648,169],{"class":155},[149,650,207],{"class":155},[149,652,653,655,658,660,662,664,667],{"class":151,"line":395},[149,654,187],{"class":155},[149,656,657],{"class":190},"fieldName",[149,659,169],{"class":155},[149,661,172],{"class":155},[149,663,198],{"class":155},[149,665,666],{"class":201},"ga:users",[149,668,227],{"class":155},[149,670,671],{"class":151,"line":410},[149,672,233],{"class":155},[149,674,675],{"class":151,"line":415},[149,676,418],{"class":155},[149,678,679],{"class":151,"line":421},[149,680,424],{"class":155},[81,682,684],{"id":683},"differences-between-results","Differences between results",[11,686,687],{},"The results have a comparable structure as well, where the tendency of the GA4 API seems to make the results more consistent and reduce additional information unless directly queried. Below we present the results for the data queries, specified above, and list the differences between them.",[91,689,690,697,722],{},[94,691,692,693,696],{},"The values for ",[15,694,695],{},"dimensions and metrics have the same structure"," in GA4 API in contrast to the original API, where dimension values are presented in an array while metrics are in an object with an array of values. This simplifies the extraction of the data.",[94,698,699,702,703,706,707,710,711,710,714,717,718,721],{},[15,700,701],{},"The summary values are not included"," automatically in the GA4 API. To receive any aggregated metrics, you need to specify which aggregation you need in a new parameter ",[105,704,705],{},"metricAggregations"," with options ",[105,708,709],{},"TOTAL",", ",[105,712,713],{},"MINIMUM",[105,715,716],{},"MAXIMUM",", and ",[105,719,720],{},"COUNT",". Therefore, you can receive the same information as through the original API but you won’t get it automatically.",[94,723,724,725,728],{},"The column header is separated for metrics and dimensions but in contrast to the original API it has the same structure for both metrics and dimensions. This corresponds to the introduced ",[15,726,727],{},"consistency in presenting values"," and in querying the names of metrics and dimensions.",[11,730,731],{},[45,732,733],{},"The results from GA4 example:",[140,735,737],{"className":142,"code":736,"language":144,"meta":145,"style":145},"{\n  \"metricHeaders\": [\n    {\n      \"name\": \"sessions\",\n      \"type\": \"TYPE_INTEGER\"\n    }\n  ],\n  \"rows\": [\n    {\n      \"dimensionValues\": [\n        {\n          \"value\": \"20210104\"\n        }\n      ],\n      \"metricValues\": [\n        {\n          \"value\": \"12900\"\n        }\n      ]\n    },\n    {\n      \"dimensionValues\": [\n        {\n          \"value\": \"20210105\"\n        }\n      ],\n      \"metricValues\": [\n        {\n          \"value\": \"10700\"\n        }\n      ]\n    },\n    {\n      \"dimensionValues\": [\n        {\n          \"value\": \"20210106\"\n        }\n      ],\n      \"metricValues\": [\n        {\n          \"value\": \"11300\"\n        }\n      ]\n    }\n  ],\n  \"metadata\": {},\n  \"dimensionHeaders\": [\n    {\n      \"name\": \"date\"\n    }\n  ],\n  \"rowCount\": 3\n}\n",[105,738,739,743,756,760,778,796,800,804,817,821,834,839,858,863,868,881,885,902,906,911,916,920,932,936,953,957,961,974,979,997,1002,1007,1012,1017,1030,1035,1053,1058,1063,1076,1081,1099,1104,1109,1114,1119,1134,1148,1153,1170,1175,1180,1195],{"__ignoreMap":145},[149,740,741],{"class":151,"line":152},[149,742,156],{"class":155},[149,744,745,747,750,752,754],{"class":151,"line":159},[149,746,162],{"class":155},[149,748,749],{"class":165},"metricHeaders",[149,751,169],{"class":155},[149,753,172],{"class":155},[149,755,175],{"class":155},[149,757,758],{"class":151,"line":178},[149,759,181],{"class":155},[149,761,762,764,766,768,770,772,774,776],{"class":151,"line":184},[149,763,187],{"class":155},[149,765,107],{"class":190},[149,767,169],{"class":155},[149,769,172],{"class":155},[149,771,198],{"class":155},[149,773,274],{"class":201},[149,775,169],{"class":155},[149,777,207],{"class":155},[149,779,780,782,785,787,789,791,794],{"class":151,"line":210},[149,781,187],{"class":155},[149,783,784],{"class":190},"type",[149,786,169],{"class":155},[149,788,172],{"class":155},[149,790,198],{"class":155},[149,792,793],{"class":201},"TYPE_INTEGER",[149,795,227],{"class":155},[149,797,798],{"class":151,"line":230},[149,799,233],{"class":155},[149,801,802],{"class":151,"line":236},[149,803,239],{"class":155},[149,805,806,808,811,813,815],{"class":151,"line":242},[149,807,162],{"class":155},[149,809,810],{"class":165},"rows",[149,812,169],{"class":155},[149,814,172],{"class":155},[149,816,175],{"class":155},[149,818,819],{"class":151,"line":256},[149,820,181],{"class":155},[149,822,823,825,828,830,832],{"class":151,"line":261},[149,824,187],{"class":155},[149,826,827],{"class":190},"dimensionValues",[149,829,169],{"class":155},[149,831,172],{"class":155},[149,833,175],{"class":155},[149,835,836],{"class":151,"line":279},[149,837,838],{"class":155},"        {\n",[149,840,841,844,847,849,851,853,856],{"class":151,"line":284},[149,842,843],{"class":155},"          \"",[149,845,846],{"class":375},"value",[149,848,169],{"class":155},[149,850,172],{"class":155},[149,852,198],{"class":155},[149,854,855],{"class":201},"20210104",[149,857,227],{"class":155},[149,859,860],{"class":151,"line":289},[149,861,862],{"class":155},"        }\n",[149,864,865],{"class":151,"line":303},[149,866,867],{"class":155},"      ],\n",[149,869,870,872,875,877,879],{"class":151,"line":308},[149,871,187],{"class":155},[149,873,874],{"class":190},"metricValues",[149,876,169],{"class":155},[149,878,172],{"class":155},[149,880,175],{"class":155},[149,882,883],{"class":151,"line":326},[149,884,838],{"class":155},[149,886,887,889,891,893,895,897,900],{"class":151,"line":331},[149,888,843],{"class":155},[149,890,846],{"class":375},[149,892,169],{"class":155},[149,894,172],{"class":155},[149,896,198],{"class":155},[149,898,899],{"class":201},"12900",[149,901,227],{"class":155},[149,903,904],{"class":151,"line":336},[149,905,862],{"class":155},[149,907,908],{"class":151,"line":349},[149,909,910],{"class":155},"      ]\n",[149,912,913],{"class":151,"line":354},[149,914,915],{"class":155},"    },\n",[149,917,918],{"class":151,"line":369},[149,919,181],{"class":155},[149,921,922,924,926,928,930],{"class":151,"line":389},[149,923,187],{"class":155},[149,925,827],{"class":190},[149,927,169],{"class":155},[149,929,172],{"class":155},[149,931,175],{"class":155},[149,933,934],{"class":151,"line":395},[149,935,838],{"class":155},[149,937,938,940,942,944,946,948,951],{"class":151,"line":410},[149,939,843],{"class":155},[149,941,846],{"class":375},[149,943,169],{"class":155},[149,945,172],{"class":155},[149,947,198],{"class":155},[149,949,950],{"class":201},"20210105",[149,952,227],{"class":155},[149,954,955],{"class":151,"line":415},[149,956,862],{"class":155},[149,958,959],{"class":151,"line":421},[149,960,867],{"class":155},[149,962,964,966,968,970,972],{"class":151,"line":963},27,[149,965,187],{"class":155},[149,967,874],{"class":190},[149,969,169],{"class":155},[149,971,172],{"class":155},[149,973,175],{"class":155},[149,975,977],{"class":151,"line":976},28,[149,978,838],{"class":155},[149,980,982,984,986,988,990,992,995],{"class":151,"line":981},29,[149,983,843],{"class":155},[149,985,846],{"class":375},[149,987,169],{"class":155},[149,989,172],{"class":155},[149,991,198],{"class":155},[149,993,994],{"class":201},"10700",[149,996,227],{"class":155},[149,998,1000],{"class":151,"line":999},30,[149,1001,862],{"class":155},[149,1003,1005],{"class":151,"line":1004},31,[149,1006,910],{"class":155},[149,1008,1010],{"class":151,"line":1009},32,[149,1011,915],{"class":155},[149,1013,1015],{"class":151,"line":1014},33,[149,1016,181],{"class":155},[149,1018,1020,1022,1024,1026,1028],{"class":151,"line":1019},34,[149,1021,187],{"class":155},[149,1023,827],{"class":190},[149,1025,169],{"class":155},[149,1027,172],{"class":155},[149,1029,175],{"class":155},[149,1031,1033],{"class":151,"line":1032},35,[149,1034,838],{"class":155},[149,1036,1038,1040,1042,1044,1046,1048,1051],{"class":151,"line":1037},36,[149,1039,843],{"class":155},[149,1041,846],{"class":375},[149,1043,169],{"class":155},[149,1045,172],{"class":155},[149,1047,198],{"class":155},[149,1049,1050],{"class":201},"20210106",[149,1052,227],{"class":155},[149,1054,1056],{"class":151,"line":1055},37,[149,1057,862],{"class":155},[149,1059,1061],{"class":151,"line":1060},38,[149,1062,867],{"class":155},[149,1064,1066,1068,1070,1072,1074],{"class":151,"line":1065},39,[149,1067,187],{"class":155},[149,1069,874],{"class":190},[149,1071,169],{"class":155},[149,1073,172],{"class":155},[149,1075,175],{"class":155},[149,1077,1079],{"class":151,"line":1078},40,[149,1080,838],{"class":155},[149,1082,1084,1086,1088,1090,1092,1094,1097],{"class":151,"line":1083},41,[149,1085,843],{"class":155},[149,1087,846],{"class":375},[149,1089,169],{"class":155},[149,1091,172],{"class":155},[149,1093,198],{"class":155},[149,1095,1096],{"class":201},"11300",[149,1098,227],{"class":155},[149,1100,1102],{"class":151,"line":1101},42,[149,1103,862],{"class":155},[149,1105,1107],{"class":151,"line":1106},43,[149,1108,910],{"class":155},[149,1110,1112],{"class":151,"line":1111},44,[149,1113,233],{"class":155},[149,1115,1117],{"class":151,"line":1116},45,[149,1118,239],{"class":155},[149,1120,1122,1124,1127,1129,1131],{"class":151,"line":1121},46,[149,1123,162],{"class":155},[149,1125,1126],{"class":165},"metadata",[149,1128,169],{"class":155},[149,1130,172],{"class":155},[149,1132,1133],{"class":155}," {},\n",[149,1135,1137,1139,1142,1144,1146],{"class":151,"line":1136},47,[149,1138,162],{"class":155},[149,1140,1141],{"class":165},"dimensionHeaders",[149,1143,169],{"class":155},[149,1145,172],{"class":155},[149,1147,175],{"class":155},[149,1149,1151],{"class":151,"line":1150},48,[149,1152,181],{"class":155},[149,1154,1156,1158,1160,1162,1164,1166,1168],{"class":151,"line":1155},49,[149,1157,187],{"class":155},[149,1159,107],{"class":190},[149,1161,169],{"class":155},[149,1163,172],{"class":155},[149,1165,198],{"class":155},[149,1167,321],{"class":201},[149,1169,227],{"class":155},[149,1171,1173],{"class":151,"line":1172},50,[149,1174,233],{"class":155},[149,1176,1178],{"class":151,"line":1177},51,[149,1179,239],{"class":155},[149,1181,1183,1185,1188,1190,1192],{"class":151,"line":1182},52,[149,1184,162],{"class":155},[149,1186,1187],{"class":165},"rowCount",[149,1189,169],{"class":155},[149,1191,172],{"class":155},[149,1193,1194],{"class":375}," 3\n",[149,1196,1198],{"class":151,"line":1197},53,[149,1199,424],{"class":155},[11,1201,1202],{},[45,1203,1204],{},"The results from UA for comparison:",[140,1206,1208],{"className":142,"code":1207,"language":144,"meta":145,"style":145},"{\n    \"columnHeader\": {\n        \"dimensions\": [\"ga:date\"],\n        \"metricHeader\": {\n            \"metricHeaderEntries\": [{\n                    \"name\": \"ga:sessions\",\n                    \"type\": \"INTEGER\"\n                }\n            ]\n        }\n    },\n    \"data\": {\n        \"rows\": [{\n                \"dimensions\": [\"20210104\"],\n                \"metrics\": [{\n                        \"values\": [\"12900\"]\n                    }\n                ]\n            }, {\n                \"dimensions\": [\"20210105\"],\n                \"metrics\": [{\n                        \"values\": [\"10700\"]\n                    }\n                ]\n            }, {\n                \"dimensions\": [\"20210106\"],\n                \"metrics\": [{\n                        \"values\": [\"11300\"]\n                    }\n                ]\n            }\n        ],\n        \"totals\": [{\n                \"values\": [\"34900\"]\n            }\n        ],\n        \"rowCount\": 3,\n        \"minimums\": [{\n                \"values\": [\"10700\"]\n            }\n        ],\n        \"maximums\": [{\n                \"values\": [\"12900\"]\n            }\n        ]\n    }\n}\n",[105,1209,1210,1214,1228,1250,1263,1278,1298,1315,1320,1325,1329,1333,1346,1358,1379,1391,1414,1419,1424,1431,1451,1463,1483,1487,1491,1497,1517,1529,1549,1553,1557,1562,1567,1580,1601,1605,1609,1624,1637,1657,1661,1665,1678,1698,1702,1707,1711],{"__ignoreMap":145},[149,1211,1212],{"class":151,"line":152},[149,1213,156],{"class":155},[149,1215,1216,1219,1222,1224,1226],{"class":151,"line":159},[149,1217,1218],{"class":155},"    \"",[149,1220,1221],{"class":165},"columnHeader",[149,1223,169],{"class":155},[149,1225,172],{"class":155},[149,1227,366],{"class":155},[149,1229,1230,1232,1234,1236,1238,1241,1243,1245,1247],{"class":151,"line":178},[149,1231,372],{"class":155},[149,1233,294],{"class":190},[149,1235,169],{"class":155},[149,1237,172],{"class":155},[149,1239,1240],{"class":155}," [",[149,1242,169],{"class":155},[149,1244,604],{"class":201},[149,1246,169],{"class":155},[149,1248,1249],{"class":155},"],\n",[149,1251,1252,1254,1257,1259,1261],{"class":151,"line":184},[149,1253,372],{"class":155},[149,1255,1256],{"class":190},"metricHeader",[149,1258,169],{"class":155},[149,1260,172],{"class":155},[149,1262,366],{"class":155},[149,1264,1265,1268,1271,1273,1275],{"class":151,"line":210},[149,1266,1267],{"class":155},"            \"",[149,1269,1270],{"class":375},"metricHeaderEntries",[149,1272,169],{"class":155},[149,1274,172],{"class":155},[149,1276,1277],{"class":155}," [{\n",[149,1279,1280,1283,1286,1288,1290,1292,1294,1296],{"class":151,"line":230},[149,1281,1282],{"class":155},"                    \"",[149,1284,107],{"class":1285},"s-wAU",[149,1287,169],{"class":155},[149,1289,172],{"class":155},[149,1291,198],{"class":155},[149,1293,547],{"class":201},[149,1295,169],{"class":155},[149,1297,207],{"class":155},[149,1299,1300,1302,1304,1306,1308,1310,1313],{"class":151,"line":236},[149,1301,1282],{"class":155},[149,1303,784],{"class":1285},[149,1305,169],{"class":155},[149,1307,172],{"class":155},[149,1309,198],{"class":155},[149,1311,1312],{"class":201},"INTEGER",[149,1314,227],{"class":155},[149,1316,1317],{"class":151,"line":242},[149,1318,1319],{"class":155},"                }\n",[149,1321,1322],{"class":151,"line":256},[149,1323,1324],{"class":155},"            ]\n",[149,1326,1327],{"class":151,"line":261},[149,1328,862],{"class":155},[149,1330,1331],{"class":151,"line":279},[149,1332,915],{"class":155},[149,1334,1335,1337,1340,1342,1344],{"class":151,"line":284},[149,1336,1218],{"class":155},[149,1338,1339],{"class":165},"data",[149,1341,169],{"class":155},[149,1343,172],{"class":155},[149,1345,366],{"class":155},[149,1347,1348,1350,1352,1354,1356],{"class":151,"line":289},[149,1349,372],{"class":155},[149,1351,810],{"class":190},[149,1353,169],{"class":155},[149,1355,172],{"class":155},[149,1357,1277],{"class":155},[149,1359,1360,1363,1365,1367,1369,1371,1373,1375,1377],{"class":151,"line":303},[149,1361,1362],{"class":155},"                \"",[149,1364,294],{"class":375},[149,1366,169],{"class":155},[149,1368,172],{"class":155},[149,1370,1240],{"class":155},[149,1372,169],{"class":155},[149,1374,855],{"class":201},[149,1376,169],{"class":155},[149,1378,1249],{"class":155},[149,1380,1381,1383,1385,1387,1389],{"class":151,"line":308},[149,1382,1362],{"class":155},[149,1384,247],{"class":375},[149,1386,169],{"class":155},[149,1388,172],{"class":155},[149,1390,1277],{"class":155},[149,1392,1393,1396,1399,1401,1403,1405,1407,1409,1411],{"class":151,"line":326},[149,1394,1395],{"class":155},"                        \"",[149,1397,1398],{"class":1285},"values",[149,1400,169],{"class":155},[149,1402,172],{"class":155},[149,1404,1240],{"class":155},[149,1406,169],{"class":155},[149,1408,899],{"class":201},[149,1410,169],{"class":155},[149,1412,1413],{"class":155},"]\n",[149,1415,1416],{"class":151,"line":331},[149,1417,1418],{"class":155},"                    }\n",[149,1420,1421],{"class":151,"line":336},[149,1422,1423],{"class":155},"                ]\n",[149,1425,1426,1429],{"class":151,"line":349},[149,1427,1428],{"class":155},"            },",[149,1430,366],{"class":155},[149,1432,1433,1435,1437,1439,1441,1443,1445,1447,1449],{"class":151,"line":354},[149,1434,1362],{"class":155},[149,1436,294],{"class":375},[149,1438,169],{"class":155},[149,1440,172],{"class":155},[149,1442,1240],{"class":155},[149,1444,169],{"class":155},[149,1446,950],{"class":201},[149,1448,169],{"class":155},[149,1450,1249],{"class":155},[149,1452,1453,1455,1457,1459,1461],{"class":151,"line":369},[149,1454,1362],{"class":155},[149,1456,247],{"class":375},[149,1458,169],{"class":155},[149,1460,172],{"class":155},[149,1462,1277],{"class":155},[149,1464,1465,1467,1469,1471,1473,1475,1477,1479,1481],{"class":151,"line":389},[149,1466,1395],{"class":155},[149,1468,1398],{"class":1285},[149,1470,169],{"class":155},[149,1472,172],{"class":155},[149,1474,1240],{"class":155},[149,1476,169],{"class":155},[149,1478,994],{"class":201},[149,1480,169],{"class":155},[149,1482,1413],{"class":155},[149,1484,1485],{"class":151,"line":395},[149,1486,1418],{"class":155},[149,1488,1489],{"class":151,"line":410},[149,1490,1423],{"class":155},[149,1492,1493,1495],{"class":151,"line":415},[149,1494,1428],{"class":155},[149,1496,366],{"class":155},[149,1498,1499,1501,1503,1505,1507,1509,1511,1513,1515],{"class":151,"line":421},[149,1500,1362],{"class":155},[149,1502,294],{"class":375},[149,1504,169],{"class":155},[149,1506,172],{"class":155},[149,1508,1240],{"class":155},[149,1510,169],{"class":155},[149,1512,1050],{"class":201},[149,1514,169],{"class":155},[149,1516,1249],{"class":155},[149,1518,1519,1521,1523,1525,1527],{"class":151,"line":963},[149,1520,1362],{"class":155},[149,1522,247],{"class":375},[149,1524,169],{"class":155},[149,1526,172],{"class":155},[149,1528,1277],{"class":155},[149,1530,1531,1533,1535,1537,1539,1541,1543,1545,1547],{"class":151,"line":976},[149,1532,1395],{"class":155},[149,1534,1398],{"class":1285},[149,1536,169],{"class":155},[149,1538,172],{"class":155},[149,1540,1240],{"class":155},[149,1542,169],{"class":155},[149,1544,1096],{"class":201},[149,1546,169],{"class":155},[149,1548,1413],{"class":155},[149,1550,1551],{"class":151,"line":981},[149,1552,1418],{"class":155},[149,1554,1555],{"class":151,"line":999},[149,1556,1423],{"class":155},[149,1558,1559],{"class":151,"line":1004},[149,1560,1561],{"class":155},"            }\n",[149,1563,1564],{"class":151,"line":1009},[149,1565,1566],{"class":155},"        ],\n",[149,1568,1569,1571,1574,1576,1578],{"class":151,"line":1014},[149,1570,372],{"class":155},[149,1572,1573],{"class":190},"totals",[149,1575,169],{"class":155},[149,1577,172],{"class":155},[149,1579,1277],{"class":155},[149,1581,1582,1584,1586,1588,1590,1592,1594,1597,1599],{"class":151,"line":1019},[149,1583,1362],{"class":155},[149,1585,1398],{"class":375},[149,1587,169],{"class":155},[149,1589,172],{"class":155},[149,1591,1240],{"class":155},[149,1593,169],{"class":155},[149,1595,1596],{"class":201},"34900",[149,1598,169],{"class":155},[149,1600,1413],{"class":155},[149,1602,1603],{"class":151,"line":1032},[149,1604,1561],{"class":155},[149,1606,1607],{"class":151,"line":1037},[149,1608,1566],{"class":155},[149,1610,1611,1613,1615,1617,1619,1622],{"class":151,"line":1055},[149,1612,372],{"class":155},[149,1614,1187],{"class":190},[149,1616,169],{"class":155},[149,1618,172],{"class":155},[149,1620,1621],{"class":375}," 3",[149,1623,207],{"class":155},[149,1625,1626,1628,1631,1633,1635],{"class":151,"line":1060},[149,1627,372],{"class":155},[149,1629,1630],{"class":190},"minimums",[149,1632,169],{"class":155},[149,1634,172],{"class":155},[149,1636,1277],{"class":155},[149,1638,1639,1641,1643,1645,1647,1649,1651,1653,1655],{"class":151,"line":1065},[149,1640,1362],{"class":155},[149,1642,1398],{"class":375},[149,1644,169],{"class":155},[149,1646,172],{"class":155},[149,1648,1240],{"class":155},[149,1650,169],{"class":155},[149,1652,994],{"class":201},[149,1654,169],{"class":155},[149,1656,1413],{"class":155},[149,1658,1659],{"class":151,"line":1078},[149,1660,1561],{"class":155},[149,1662,1663],{"class":151,"line":1083},[149,1664,1566],{"class":155},[149,1666,1667,1669,1672,1674,1676],{"class":151,"line":1101},[149,1668,372],{"class":155},[149,1670,1671],{"class":190},"maximums",[149,1673,169],{"class":155},[149,1675,172],{"class":155},[149,1677,1277],{"class":155},[149,1679,1680,1682,1684,1686,1688,1690,1692,1694,1696],{"class":151,"line":1106},[149,1681,1362],{"class":155},[149,1683,1398],{"class":375},[149,1685,169],{"class":155},[149,1687,172],{"class":155},[149,1689,1240],{"class":155},[149,1691,169],{"class":155},[149,1693,899],{"class":201},[149,1695,169],{"class":155},[149,1697,1413],{"class":155},[149,1699,1700],{"class":151,"line":1111},[149,1701,1561],{"class":155},[149,1703,1704],{"class":151,"line":1116},[149,1705,1706],{"class":155},"        ]\n",[149,1708,1709],{"class":151,"line":1121},[149,1710,233],{"class":155},[149,1712,1713],{"class":151,"line":1136},[149,1714,424],{"class":155},[11,1716,1717],{},"Overall, as you can see in the included example the structure of both the query and the resulting response is very similar with some steps towards consistency between dimensions’ and metrics’ specification and presentation. Therefore, there does not seem to be an obstacle from moving from simple queries in the original API to the simple queries in the GA4 API. So, let us investigate what the GA4 API brings additionally.",[64,1719,1721],{"id":1720},"further-parameters-in-a-single-query","Further parameters in a single query",[81,1723,1725],{"id":1724},"quotas-report","Quotas report",[11,1727,1728],{},"One of the new features offered by the GA4 API is the option to view the quotas for a given property. This information serves as a warning if you are nearing any of the thresholds or for informative purposes about the number of tokens consumed by a given request because requests in GA4 API cost a different amount of tokens based on their complexity. If you run too many complex requests, you will reach the limit of your available quotas and may need to wait for the next hour or the next day, depending on the type of quota you have reached.",[11,1730,1731,1732,1735,1736,1739,1740,1743,1744,1747,1748,1751,1752,1755],{},"The quotas information can be received by setting the optional parameter ",[105,1733,1734],{},"returnPropertyQuotas"," to true. This results in an additional object in the results added on the same level as rows or headers. The results contain 5 quotas information. First, they inform you about the number of ",[15,1737,1738],{},"tokens consumed"," by the current query ",[15,1741,1742],{},"and remaining"," tokens per day and per hour. According to the quotas report in the included example, standard property has in total 25,000 tokens per day and 5,000 tokens per hour available for the GA4 API. The current request that queried this information along with other data consumed 5 tokens from the limits. Additionally, it provides information about the remaining ",[15,1745,1746],{},"permitted concurrent requests"," and ",[15,1749,1750],{},"permitted server errors"," for the given project. There can be only 10 requests running in parallel and there can be no more than 10 server errors (responses with code 500 or 503) in an hour for the whole project, otherwise, Google allows no further queries to be processed until the hour passes. Lastly, up to 120 requests with ",[15,1753,1754],{},"potentially thresholded dimensions"," per hour are allowed. Aomng the potentially thresholded dimensions belongs userAgeBracket, userGender, brandingInterest, audienceId, and audienceName. This limit is imposed to prevent inference of user demographics or interests.",[140,1757,1759],{"className":142,"code":1758,"language":144,"meta":145,"style":145},"        \"propertyQuota\": {\n            \"tokensPerDay\": {\n                \"consumed\": 5,\n                \"remaining\": 24986\n            },\n            \"tokensPerHour\": {\n                \"consumed\": 5,\n                \"remaining\": 4990\n            },\n            \"concurrentRequests\": {\n                \"remaining\": 10\n            },\n            \"serverErrorsPerProjectPerHour\": {\n                \"remaining\": 10\n            },\n            \"potentiallyThresholdedRequestsPerHour\": {\n                \"remaining\": 120\n            }\n        }\n",[105,1760,1761,1776,1789,1805,1819,1824,1837,1851,1864,1868,1881,1894,1898,1911,1923,1927,1940,1953,1957],{"__ignoreMap":145},[149,1762,1763,1765,1768,1770,1774],{"class":151,"line":152},[149,1764,372],{"class":155},[149,1766,1767],{"class":201},"propertyQuota",[149,1769,169],{"class":155},[149,1771,1773],{"class":1772},"s0W1g",": ",[149,1775,156],{"class":155},[149,1777,1778,1780,1783,1785,1787],{"class":151,"line":159},[149,1779,1267],{"class":155},[149,1781,1782],{"class":165},"tokensPerDay",[149,1784,169],{"class":155},[149,1786,172],{"class":155},[149,1788,366],{"class":155},[149,1790,1791,1793,1796,1798,1800,1803],{"class":151,"line":178},[149,1792,1362],{"class":155},[149,1794,1795],{"class":190},"consumed",[149,1797,169],{"class":155},[149,1799,172],{"class":155},[149,1801,1802],{"class":375}," 5",[149,1804,207],{"class":155},[149,1806,1807,1809,1812,1814,1816],{"class":151,"line":184},[149,1808,1362],{"class":155},[149,1810,1811],{"class":190},"remaining",[149,1813,169],{"class":155},[149,1815,172],{"class":155},[149,1817,1818],{"class":375}," 24986\n",[149,1820,1821],{"class":151,"line":210},[149,1822,1823],{"class":155},"            },\n",[149,1825,1826,1828,1831,1833,1835],{"class":151,"line":230},[149,1827,1267],{"class":155},[149,1829,1830],{"class":165},"tokensPerHour",[149,1832,169],{"class":155},[149,1834,172],{"class":155},[149,1836,366],{"class":155},[149,1838,1839,1841,1843,1845,1847,1849],{"class":151,"line":236},[149,1840,1362],{"class":155},[149,1842,1795],{"class":190},[149,1844,169],{"class":155},[149,1846,172],{"class":155},[149,1848,1802],{"class":375},[149,1850,207],{"class":155},[149,1852,1853,1855,1857,1859,1861],{"class":151,"line":242},[149,1854,1362],{"class":155},[149,1856,1811],{"class":190},[149,1858,169],{"class":155},[149,1860,172],{"class":155},[149,1862,1863],{"class":375}," 4990\n",[149,1865,1866],{"class":151,"line":256},[149,1867,1823],{"class":155},[149,1869,1870,1872,1875,1877,1879],{"class":151,"line":261},[149,1871,1267],{"class":155},[149,1873,1874],{"class":165},"concurrentRequests",[149,1876,169],{"class":155},[149,1878,172],{"class":155},[149,1880,366],{"class":155},[149,1882,1883,1885,1887,1889,1891],{"class":151,"line":279},[149,1884,1362],{"class":155},[149,1886,1811],{"class":190},[149,1888,169],{"class":155},[149,1890,172],{"class":155},[149,1892,1893],{"class":375}," 10\n",[149,1895,1896],{"class":151,"line":284},[149,1897,1823],{"class":155},[149,1899,1900,1902,1905,1907,1909],{"class":151,"line":289},[149,1901,1267],{"class":155},[149,1903,1904],{"class":165},"serverErrorsPerProjectPerHour",[149,1906,169],{"class":155},[149,1908,172],{"class":155},[149,1910,366],{"class":155},[149,1912,1913,1915,1917,1919,1921],{"class":151,"line":303},[149,1914,1362],{"class":155},[149,1916,1811],{"class":190},[149,1918,169],{"class":155},[149,1920,172],{"class":155},[149,1922,1893],{"class":375},[149,1924,1925],{"class":151,"line":308},[149,1926,1823],{"class":155},[149,1928,1929,1931,1934,1936,1938],{"class":151,"line":326},[149,1930,1267],{"class":155},[149,1932,1933],{"class":165},"potentiallyThresholdedRequestsPerHour",[149,1935,169],{"class":155},[149,1937,172],{"class":155},[149,1939,366],{"class":155},[149,1941,1942,1944,1946,1948,1950],{"class":151,"line":331},[149,1943,1362],{"class":155},[149,1945,1811],{"class":190},[149,1947,169],{"class":155},[149,1949,172],{"class":155},[149,1951,1952],{"class":375}," 120\n",[149,1954,1955],{"class":151,"line":336},[149,1956,1561],{"class":155},[149,1958,1959],{"class":151,"line":349},[149,1960,862],{"class":155},[81,1962,1964],{"id":1963},"notes-on-filters","Notes on filters",[11,1966,1967,1968,1971],{},"Next, we include a comment on the filters in the GA4 API. The filters for metrics and dimensions are separated in the same way as for the original API. There is no ",[105,1969,1970],{},"filtersExpression"," parameter that would allow simple filters to be written in one line.",[11,1973,1974,1975,1978,1979,1982,1983,710,1986,1747,1989,1992],{},"However, the dimension and metric filters are now much more flexible regarding combinations of multiple filters together. In the original API, you could combine multiple filters on only one level, specifying that either all filters should hold (using the ",[105,1976,1977],{},"and"," operator) or that it is sufficient for only one of the filters to be satisfied (using the ",[105,1980,1981],{},"or"," operator). In the GA4 API, there is an option to chain several of these operators using a set of the following parameters successively: ",[105,1984,1985],{},"andGroup",[105,1987,1988],{},"orGroup",[105,1990,1991],{},"notExpression",". For example, if you need to analyze multiple groups of visitors or events where at least one group is specified by more than one condition (e.g. people who visited a certain page using a mobile phone or when an error occurred for people coming from a particular source), you can easily do it in the GA4 API while you would need separate requests using the original API.",[11,1994,1995],{},"Below you can find an example of the dimension filter with multiple chained conditions. This query can be used to checking multiple reported device-specific events at once. The conditions can be simplified into:",[1997,1998,1999,2002,2005,2006,2008,2011,2013,2014,2016,2019],"example",{},[15,2000,2001],{},"Example",[2003,2004],"br",{},"\n\n\nEITHER\n",[2003,2007],{},[105,2009,2010],{},"(deviceCategory == \"Mobile\" AND pagePath == \"\u002Fpath-to-page\")",[2003,2012],{},"\n\n\nOR\n",[2003,2015],{},[105,2017,2018],{},"(deviceCategory == \"Tablet\" AND pagePath == \"\u002Fpath-to-another-page\")",[2003,2020],{},[140,2022,2024],{"className":142,"code":2023,"language":144,"meta":145,"style":145},"{\n    \"dimensionFilter\": {\n      \"orGroup\": {\n        \"expressions\": [\n          {\n            \"andGroup\": {\n              \"expressions\": [\n                {\n                  \"filter\": {\n                    \"stringFilter\": {\n                      \"value\": \"Mobile\"\n                    },\n                    \"fieldName\": \"deviceCategory\"\n                  }\n                },\n                {\n                  \"filter\": {\n                    \"stringFilter\": {\n                      \"value\": \"\u002Fpath-to-page\"\n                    },\n                    \"fieldName\": \"pagePath\"\n                  }\n                }\n              ]\n            }\n          }, \n        {\n            \"andGroup\": {\n              \"expressions\": [\n                {\n                  \"filter\": {\n                    \"stringFilter\": {\n                      \"value\": \"Tablet\"\n                    },\n                    \"fieldName\": \"deviceCategory\"\n                  }\n                },\n                {\n                  \"filter\": {\n                    \"stringFilter\": {\n                      \"value\": \"\u002Fpath-to-different-page\"\n                    },\n                    \"fieldName\": \"pagePath\"\n                  }\n                }\n              ]\n            }\n          }\n        ]\n      }\n    }\n  }\n",[105,2025,2026,2030,2043,2055,2068,2073,2085,2099,2104,2119,2133,2151,2156,2173,2178,2183,2187,2199,2211,2228,2232,2249,2253,2257,2262,2266,2274,2278,2290,2302,2306,2318,2330,2347,2351,2367,2371,2375,2379,2391,2403,2420,2424,2440,2444,2448,2452,2456,2461,2465,2470,2474],{"__ignoreMap":145},[149,2027,2028],{"class":151,"line":152},[149,2029,156],{"class":155},[149,2031,2032,2034,2037,2039,2041],{"class":151,"line":159},[149,2033,1218],{"class":155},[149,2035,2036],{"class":165},"dimensionFilter",[149,2038,169],{"class":155},[149,2040,172],{"class":155},[149,2042,366],{"class":155},[149,2044,2045,2047,2049,2051,2053],{"class":151,"line":178},[149,2046,187],{"class":155},[149,2048,1988],{"class":190},[149,2050,169],{"class":155},[149,2052,172],{"class":155},[149,2054,366],{"class":155},[149,2056,2057,2059,2062,2064,2066],{"class":151,"line":184},[149,2058,372],{"class":155},[149,2060,2061],{"class":375},"expressions",[149,2063,169],{"class":155},[149,2065,172],{"class":155},[149,2067,175],{"class":155},[149,2069,2070],{"class":151,"line":210},[149,2071,2072],{"class":155},"          {\n",[149,2074,2075,2077,2079,2081,2083],{"class":151,"line":230},[149,2076,1267],{"class":155},[149,2078,1985],{"class":1285},[149,2080,169],{"class":155},[149,2082,172],{"class":155},[149,2084,366],{"class":155},[149,2086,2087,2090,2093,2095,2097],{"class":151,"line":236},[149,2088,2089],{"class":155},"              \"",[149,2091,2061],{"class":2092},"s9WhI",[149,2094,169],{"class":155},[149,2096,172],{"class":155},[149,2098,175],{"class":155},[149,2100,2101],{"class":151,"line":242},[149,2102,2103],{"class":155},"                {\n",[149,2105,2106,2109,2113,2115,2117],{"class":151,"line":256},[149,2107,2108],{"class":155},"                  \"",[149,2110,2112],{"class":2111},"sdLwU","filter",[149,2114,169],{"class":155},[149,2116,172],{"class":155},[149,2118,366],{"class":155},[149,2120,2121,2123,2127,2129,2131],{"class":151,"line":261},[149,2122,1282],{"class":155},[149,2124,2126],{"class":2125},"sbqyR","stringFilter",[149,2128,169],{"class":155},[149,2130,172],{"class":155},[149,2132,366],{"class":155},[149,2134,2135,2138,2140,2142,2144,2146,2149],{"class":151,"line":279},[149,2136,2137],{"class":155},"                      \"",[149,2139,846],{"class":165},[149,2141,169],{"class":155},[149,2143,172],{"class":155},[149,2145,198],{"class":155},[149,2147,2148],{"class":201},"Mobile",[149,2150,227],{"class":155},[149,2152,2153],{"class":151,"line":284},[149,2154,2155],{"class":155},"                    },\n",[149,2157,2158,2160,2162,2164,2166,2168,2171],{"class":151,"line":289},[149,2159,1282],{"class":155},[149,2161,657],{"class":2125},[149,2163,169],{"class":155},[149,2165,172],{"class":155},[149,2167,198],{"class":155},[149,2169,2170],{"class":201},"deviceCategory",[149,2172,227],{"class":155},[149,2174,2175],{"class":151,"line":303},[149,2176,2177],{"class":155},"                  }\n",[149,2179,2180],{"class":151,"line":308},[149,2181,2182],{"class":155},"                },\n",[149,2184,2185],{"class":151,"line":326},[149,2186,2103],{"class":155},[149,2188,2189,2191,2193,2195,2197],{"class":151,"line":331},[149,2190,2108],{"class":155},[149,2192,2112],{"class":2111},[149,2194,169],{"class":155},[149,2196,172],{"class":155},[149,2198,366],{"class":155},[149,2200,2201,2203,2205,2207,2209],{"class":151,"line":336},[149,2202,1282],{"class":155},[149,2204,2126],{"class":2125},[149,2206,169],{"class":155},[149,2208,172],{"class":155},[149,2210,366],{"class":155},[149,2212,2213,2215,2217,2219,2221,2223,2226],{"class":151,"line":349},[149,2214,2137],{"class":155},[149,2216,846],{"class":165},[149,2218,169],{"class":155},[149,2220,172],{"class":155},[149,2222,198],{"class":155},[149,2224,2225],{"class":201},"\u002Fpath-to-page",[149,2227,227],{"class":155},[149,2229,2230],{"class":151,"line":354},[149,2231,2155],{"class":155},[149,2233,2234,2236,2238,2240,2242,2244,2247],{"class":151,"line":369},[149,2235,1282],{"class":155},[149,2237,657],{"class":2125},[149,2239,169],{"class":155},[149,2241,172],{"class":155},[149,2243,198],{"class":155},[149,2245,2246],{"class":201},"pagePath",[149,2248,227],{"class":155},[149,2250,2251],{"class":151,"line":389},[149,2252,2177],{"class":155},[149,2254,2255],{"class":151,"line":395},[149,2256,1319],{"class":155},[149,2258,2259],{"class":151,"line":410},[149,2260,2261],{"class":155},"              ]\n",[149,2263,2264],{"class":151,"line":415},[149,2265,1561],{"class":155},[149,2267,2268,2271],{"class":151,"line":421},[149,2269,2270],{"class":155},"          },",[149,2272,2273],{"class":1772}," \n",[149,2275,2276],{"class":151,"line":963},[149,2277,838],{"class":155},[149,2279,2280,2282,2284,2286,2288],{"class":151,"line":976},[149,2281,1267],{"class":155},[149,2283,1985],{"class":1285},[149,2285,169],{"class":155},[149,2287,172],{"class":155},[149,2289,366],{"class":155},[149,2291,2292,2294,2296,2298,2300],{"class":151,"line":981},[149,2293,2089],{"class":155},[149,2295,2061],{"class":2092},[149,2297,169],{"class":155},[149,2299,172],{"class":155},[149,2301,175],{"class":155},[149,2303,2304],{"class":151,"line":999},[149,2305,2103],{"class":155},[149,2307,2308,2310,2312,2314,2316],{"class":151,"line":1004},[149,2309,2108],{"class":155},[149,2311,2112],{"class":2111},[149,2313,169],{"class":155},[149,2315,172],{"class":155},[149,2317,366],{"class":155},[149,2319,2320,2322,2324,2326,2328],{"class":151,"line":1009},[149,2321,1282],{"class":155},[149,2323,2126],{"class":2125},[149,2325,169],{"class":155},[149,2327,172],{"class":155},[149,2329,366],{"class":155},[149,2331,2332,2334,2336,2338,2340,2342,2345],{"class":151,"line":1014},[149,2333,2137],{"class":155},[149,2335,846],{"class":165},[149,2337,169],{"class":155},[149,2339,172],{"class":155},[149,2341,198],{"class":155},[149,2343,2344],{"class":201},"Tablet",[149,2346,227],{"class":155},[149,2348,2349],{"class":151,"line":1019},[149,2350,2155],{"class":155},[149,2352,2353,2355,2357,2359,2361,2363,2365],{"class":151,"line":1032},[149,2354,1282],{"class":155},[149,2356,657],{"class":2125},[149,2358,169],{"class":155},[149,2360,172],{"class":155},[149,2362,198],{"class":155},[149,2364,2170],{"class":201},[149,2366,227],{"class":155},[149,2368,2369],{"class":151,"line":1037},[149,2370,2177],{"class":155},[149,2372,2373],{"class":151,"line":1055},[149,2374,2182],{"class":155},[149,2376,2377],{"class":151,"line":1060},[149,2378,2103],{"class":155},[149,2380,2381,2383,2385,2387,2389],{"class":151,"line":1065},[149,2382,2108],{"class":155},[149,2384,2112],{"class":2111},[149,2386,169],{"class":155},[149,2388,172],{"class":155},[149,2390,366],{"class":155},[149,2392,2393,2395,2397,2399,2401],{"class":151,"line":1078},[149,2394,1282],{"class":155},[149,2396,2126],{"class":2125},[149,2398,169],{"class":155},[149,2400,172],{"class":155},[149,2402,366],{"class":155},[149,2404,2405,2407,2409,2411,2413,2415,2418],{"class":151,"line":1083},[149,2406,2137],{"class":155},[149,2408,846],{"class":165},[149,2410,169],{"class":155},[149,2412,172],{"class":155},[149,2414,198],{"class":155},[149,2416,2417],{"class":201},"\u002Fpath-to-different-page",[149,2419,227],{"class":155},[149,2421,2422],{"class":151,"line":1101},[149,2423,2155],{"class":155},[149,2425,2426,2428,2430,2432,2434,2436,2438],{"class":151,"line":1106},[149,2427,1282],{"class":155},[149,2429,657],{"class":2125},[149,2431,169],{"class":155},[149,2433,172],{"class":155},[149,2435,198],{"class":155},[149,2437,2246],{"class":201},[149,2439,227],{"class":155},[149,2441,2442],{"class":151,"line":1111},[149,2443,2177],{"class":155},[149,2445,2446],{"class":151,"line":1116},[149,2447,1319],{"class":155},[149,2449,2450],{"class":151,"line":1121},[149,2451,2261],{"class":155},[149,2453,2454],{"class":151,"line":1136},[149,2455,1561],{"class":155},[149,2457,2458],{"class":151,"line":1150},[149,2459,2460],{"class":155},"          }\n",[149,2462,2463],{"class":151,"line":1155},[149,2464,1706],{"class":155},[149,2466,2467],{"class":151,"line":1172},[149,2468,2469],{"class":155},"      }\n",[149,2471,2472],{"class":151,"line":1177},[149,2473,233],{"class":155},[149,2475,2476],{"class":151,"line":1182},[149,2477,2478],{"class":155},"  }\n",[11,2480,2481,2482,710,2485,710,2487,710,2490,1747,2493,2496,2497,1747,2499,2501,2502,2504,2505,2507],{},"For the individual dimension or metric filter there are several options for filter types: ",[105,2483,2484],{},"nullFilter",[105,2486,2126],{},[105,2488,2489],{},"inListFilter",[105,2491,2492],{},"numericFilter",[105,2494,2495],{},"betweenFilter",". While these are not entirely innovative, they present a more systematic way of selecting the type by separating ",[105,2498,2489],{},[105,2500,2495],{}," from the classical numeric and string filters. The ",[105,2503,2484],{}," offers an option to check for null values in a dimension. It can be accompanied by ",[105,2506,1991],{}," to exclude all rows with null values in a certain dimension.",[81,2509,2511],{"id":2510},"cohorts","Cohorts",[11,2513,2514,2515,2519,2520,2523,2524,2526],{},"Cohorts were possible to analyze already in the original API. To learn more about that, check our article on extended options in the ",[32,2516,2518],{"href":34,"rel":2517},[36],"original API version v4",". The options to run cohort report requests haven’t changed so much yet. It is still only possible to define a cohort by the time of their first visit, by setting the cohort dimension to ",[105,2521,2522],{},"firstTouchDate",". You further specify a name to denote the cohort group and the date range for the ",[105,2525,2522],{}," that defines the cohort.",[11,2528,2529],{},"An improvement over the previous state is the flexibility to define the period for which the cohort should be observed. Unlike before, you specify the granularity of the report, and by setting the start and end offset and choose for how many of these granularity time periods the report should extend. The original API selects the observation period for you automatically.",[11,2531,2532],{},"We show an example of how you can compare weekly cohorts that come first in various weeks before Christmas and determine whether the people that come closer before Christmas stay active in a similar proportion to people who come long before Christmas. The query asks for the proportion of active users several weeks after their first visit. The results contain data for users with first visits in one of the three selected weeks (second week of October, the second week of November, and second week of December). You can see how many of them returned one to four weeks after their first visit where the weeks are depicted on the horizontal axis and the returning share on the vertical axis. As you can see from the graph, there is a difference between people from the selected weeks. In this case, people with first visits closer to Christmas came in a higher share in the next week, however, in the longer term, they have a lower retention rate.",[11,2534,2535],{},[2536,2537],"img",{"alt":145,"src":2538,"title":2539},"\u002Fupload\u002Fcohort.webp","Cohort Comparison",[140,2541,2543],{"className":142,"code":2542,"language":144,"meta":145,"style":145},"    {\n        \"dimensions\": [\n            {\n                \"name\": \"cohort\"\n            },\n            {\n                \"name\": \"cohortNthWeek\"\n            }\n        ],\n        \"metrics\": [\n        {\n          \"name\": \"cohortRetentionFraction\",\n          \"expression\": \"cohortActiveUsers\u002FcohortTotalUsers\"\n        }\n      ],\n        \"cohortSpec\": {\n            \"cohorts\": [\n                {\n                    \"name\": \"20-10-02\",\n                    \"dimension\": \"firstTouchDate\",\n                    \"dateRange\": {\n                        \"startDate\": \"2020-10-05\",\n                        \"endDate\": \"2020-10-11\"\n                    }\n                },\n                {\n                    \"name\": \"20-11-02\",\n                    \"dimension\": \"firstTouchDate\",\n                    \"dateRange\": {\n                        \"startDate\": \"2020-11-09\",\n                        \"endDate\": \"2020-11-15\"\n                    }\n                },\n                {\n                    \"name\": \"20-12-02\",\n                    \"dimension\": \"firstTouchDate\",\n                    \"dateRange\": {\n                        \"startDate\": \"2020-12-08\",\n                        \"endDate\": \"2020-12-14\"\n                    }\n                }\n            ],\n            \"cohortsRange\": {\n                \"granularity\": \"WEEKLY\",\n                \"startOffset\": 0,\n                \"endOffset\": 4\n            }\n        }\n    }\n",[105,2544,2545,2549,2561,2566,2583,2587,2591,2608,2612,2616,2628,2632,2651,2668,2672,2676,2689,2701,2705,2724,2743,2756,2775,2792,2796,2800,2804,2823,2841,2853,2872,2889,2893,2897,2901,2920,2938,2950,2969,2986,2990,2994,2999,3012,3032,3048,3062,3066,3070],{"__ignoreMap":145},[149,2546,2547],{"class":151,"line":152},[149,2548,181],{"class":155},[149,2550,2551,2553,2555,2557,2559],{"class":151,"line":159},[149,2552,372],{"class":155},[149,2554,294],{"class":165},[149,2556,169],{"class":155},[149,2558,172],{"class":155},[149,2560,175],{"class":155},[149,2562,2563],{"class":151,"line":178},[149,2564,2565],{"class":155},"            {\n",[149,2567,2568,2570,2572,2574,2576,2578,2581],{"class":151,"line":184},[149,2569,1362],{"class":155},[149,2571,107],{"class":190},[149,2573,169],{"class":155},[149,2575,172],{"class":155},[149,2577,198],{"class":155},[149,2579,2580],{"class":201},"cohort",[149,2582,227],{"class":155},[149,2584,2585],{"class":151,"line":210},[149,2586,1823],{"class":155},[149,2588,2589],{"class":151,"line":230},[149,2590,2565],{"class":155},[149,2592,2593,2595,2597,2599,2601,2603,2606],{"class":151,"line":236},[149,2594,1362],{"class":155},[149,2596,107],{"class":190},[149,2598,169],{"class":155},[149,2600,172],{"class":155},[149,2602,198],{"class":155},[149,2604,2605],{"class":201},"cohortNthWeek",[149,2607,227],{"class":155},[149,2609,2610],{"class":151,"line":242},[149,2611,1561],{"class":155},[149,2613,2614],{"class":151,"line":256},[149,2615,1566],{"class":155},[149,2617,2618,2620,2622,2624,2626],{"class":151,"line":261},[149,2619,372],{"class":155},[149,2621,247],{"class":165},[149,2623,169],{"class":155},[149,2625,172],{"class":155},[149,2627,175],{"class":155},[149,2629,2630],{"class":151,"line":279},[149,2631,838],{"class":155},[149,2633,2634,2636,2638,2640,2642,2644,2647,2649],{"class":151,"line":284},[149,2635,843],{"class":155},[149,2637,107],{"class":190},[149,2639,169],{"class":155},[149,2641,172],{"class":155},[149,2643,198],{"class":155},[149,2645,2646],{"class":201},"cohortRetentionFraction",[149,2648,169],{"class":155},[149,2650,207],{"class":155},[149,2652,2653,2655,2657,2659,2661,2663,2666],{"class":151,"line":289},[149,2654,843],{"class":155},[149,2656,111],{"class":190},[149,2658,169],{"class":155},[149,2660,172],{"class":155},[149,2662,198],{"class":155},[149,2664,2665],{"class":201},"cohortActiveUsers\u002FcohortTotalUsers",[149,2667,227],{"class":155},[149,2669,2670],{"class":151,"line":303},[149,2671,862],{"class":155},[149,2673,2674],{"class":151,"line":308},[149,2675,867],{"class":155},[149,2677,2678,2680,2683,2685,2687],{"class":151,"line":326},[149,2679,372],{"class":155},[149,2681,2682],{"class":165},"cohortSpec",[149,2684,169],{"class":155},[149,2686,172],{"class":155},[149,2688,366],{"class":155},[149,2690,2691,2693,2695,2697,2699],{"class":151,"line":331},[149,2692,1267],{"class":155},[149,2694,2510],{"class":190},[149,2696,169],{"class":155},[149,2698,172],{"class":155},[149,2700,175],{"class":155},[149,2702,2703],{"class":151,"line":336},[149,2704,2103],{"class":155},[149,2706,2707,2709,2711,2713,2715,2717,2720,2722],{"class":151,"line":349},[149,2708,1282],{"class":155},[149,2710,107],{"class":375},[149,2712,169],{"class":155},[149,2714,172],{"class":155},[149,2716,198],{"class":155},[149,2718,2719],{"class":201},"20-10-02",[149,2721,169],{"class":155},[149,2723,207],{"class":155},[149,2725,2726,2728,2731,2733,2735,2737,2739,2741],{"class":151,"line":354},[149,2727,1282],{"class":155},[149,2729,2730],{"class":375},"dimension",[149,2732,169],{"class":155},[149,2734,172],{"class":155},[149,2736,198],{"class":155},[149,2738,2522],{"class":201},[149,2740,169],{"class":155},[149,2742,207],{"class":155},[149,2744,2745,2747,2750,2752,2754],{"class":151,"line":369},[149,2746,1282],{"class":155},[149,2748,2749],{"class":375},"dateRange",[149,2751,169],{"class":155},[149,2753,172],{"class":155},[149,2755,366],{"class":155},[149,2757,2758,2760,2762,2764,2766,2768,2771,2773],{"class":151,"line":389},[149,2759,1395],{"class":155},[149,2761,191],{"class":1285},[149,2763,169],{"class":155},[149,2765,172],{"class":155},[149,2767,198],{"class":155},[149,2769,2770],{"class":201},"2020-10-05",[149,2772,169],{"class":155},[149,2774,207],{"class":155},[149,2776,2777,2779,2781,2783,2785,2787,2790],{"class":151,"line":395},[149,2778,1395],{"class":155},[149,2780,215],{"class":1285},[149,2782,169],{"class":155},[149,2784,172],{"class":155},[149,2786,198],{"class":155},[149,2788,2789],{"class":201},"2020-10-11",[149,2791,227],{"class":155},[149,2793,2794],{"class":151,"line":410},[149,2795,1418],{"class":155},[149,2797,2798],{"class":151,"line":415},[149,2799,2182],{"class":155},[149,2801,2802],{"class":151,"line":421},[149,2803,2103],{"class":155},[149,2805,2806,2808,2810,2812,2814,2816,2819,2821],{"class":151,"line":963},[149,2807,1282],{"class":155},[149,2809,107],{"class":375},[149,2811,169],{"class":155},[149,2813,172],{"class":155},[149,2815,198],{"class":155},[149,2817,2818],{"class":201},"20-11-02",[149,2820,169],{"class":155},[149,2822,207],{"class":155},[149,2824,2825,2827,2829,2831,2833,2835,2837,2839],{"class":151,"line":976},[149,2826,1282],{"class":155},[149,2828,2730],{"class":375},[149,2830,169],{"class":155},[149,2832,172],{"class":155},[149,2834,198],{"class":155},[149,2836,2522],{"class":201},[149,2838,169],{"class":155},[149,2840,207],{"class":155},[149,2842,2843,2845,2847,2849,2851],{"class":151,"line":981},[149,2844,1282],{"class":155},[149,2846,2749],{"class":375},[149,2848,169],{"class":155},[149,2850,172],{"class":155},[149,2852,366],{"class":155},[149,2854,2855,2857,2859,2861,2863,2865,2868,2870],{"class":151,"line":999},[149,2856,1395],{"class":155},[149,2858,191],{"class":1285},[149,2860,169],{"class":155},[149,2862,172],{"class":155},[149,2864,198],{"class":155},[149,2866,2867],{"class":201},"2020-11-09",[149,2869,169],{"class":155},[149,2871,207],{"class":155},[149,2873,2874,2876,2878,2880,2882,2884,2887],{"class":151,"line":1004},[149,2875,1395],{"class":155},[149,2877,215],{"class":1285},[149,2879,169],{"class":155},[149,2881,172],{"class":155},[149,2883,198],{"class":155},[149,2885,2886],{"class":201},"2020-11-15",[149,2888,227],{"class":155},[149,2890,2891],{"class":151,"line":1009},[149,2892,1418],{"class":155},[149,2894,2895],{"class":151,"line":1014},[149,2896,2182],{"class":155},[149,2898,2899],{"class":151,"line":1019},[149,2900,2103],{"class":155},[149,2902,2903,2905,2907,2909,2911,2913,2916,2918],{"class":151,"line":1032},[149,2904,1282],{"class":155},[149,2906,107],{"class":375},[149,2908,169],{"class":155},[149,2910,172],{"class":155},[149,2912,198],{"class":155},[149,2914,2915],{"class":201},"20-12-02",[149,2917,169],{"class":155},[149,2919,207],{"class":155},[149,2921,2922,2924,2926,2928,2930,2932,2934,2936],{"class":151,"line":1037},[149,2923,1282],{"class":155},[149,2925,2730],{"class":375},[149,2927,169],{"class":155},[149,2929,172],{"class":155},[149,2931,198],{"class":155},[149,2933,2522],{"class":201},[149,2935,169],{"class":155},[149,2937,207],{"class":155},[149,2939,2940,2942,2944,2946,2948],{"class":151,"line":1055},[149,2941,1282],{"class":155},[149,2943,2749],{"class":375},[149,2945,169],{"class":155},[149,2947,172],{"class":155},[149,2949,366],{"class":155},[149,2951,2952,2954,2956,2958,2960,2962,2965,2967],{"class":151,"line":1060},[149,2953,1395],{"class":155},[149,2955,191],{"class":1285},[149,2957,169],{"class":155},[149,2959,172],{"class":155},[149,2961,198],{"class":155},[149,2963,2964],{"class":201},"2020-12-08",[149,2966,169],{"class":155},[149,2968,207],{"class":155},[149,2970,2971,2973,2975,2977,2979,2981,2984],{"class":151,"line":1065},[149,2972,1395],{"class":155},[149,2974,215],{"class":1285},[149,2976,169],{"class":155},[149,2978,172],{"class":155},[149,2980,198],{"class":155},[149,2982,2983],{"class":201},"2020-12-14",[149,2985,227],{"class":155},[149,2987,2988],{"class":151,"line":1078},[149,2989,1418],{"class":155},[149,2991,2992],{"class":151,"line":1083},[149,2993,1319],{"class":155},[149,2995,2996],{"class":151,"line":1101},[149,2997,2998],{"class":155},"            ],\n",[149,3000,3001,3003,3006,3008,3010],{"class":151,"line":1106},[149,3002,1267],{"class":155},[149,3004,3005],{"class":190},"cohortsRange",[149,3007,169],{"class":155},[149,3009,172],{"class":155},[149,3011,366],{"class":155},[149,3013,3014,3016,3019,3021,3023,3025,3028,3030],{"class":151,"line":1111},[149,3015,1362],{"class":155},[149,3017,3018],{"class":375},"granularity",[149,3020,169],{"class":155},[149,3022,172],{"class":155},[149,3024,198],{"class":155},[149,3026,3027],{"class":201},"WEEKLY",[149,3029,169],{"class":155},[149,3031,207],{"class":155},[149,3033,3034,3036,3039,3041,3043,3046],{"class":151,"line":1116},[149,3035,1362],{"class":155},[149,3037,3038],{"class":375},"startOffset",[149,3040,169],{"class":155},[149,3042,172],{"class":155},[149,3044,3045],{"class":375}," 0",[149,3047,207],{"class":155},[149,3049,3050,3052,3055,3057,3059],{"class":151,"line":1121},[149,3051,1362],{"class":155},[149,3053,3054],{"class":375},"endOffset",[149,3056,169],{"class":155},[149,3058,172],{"class":155},[149,3060,3061],{"class":375}," 4\n",[149,3063,3064],{"class":151,"line":1136},[149,3065,1561],{"class":155},[149,3067,3068],{"class":151,"line":1150},[149,3069,862],{"class":155},[149,3071,3072],{"class":151,"line":1155},[149,3073,233],{"class":155},[11,3075,3076,3077,3082],{},"For more examples, ",[32,3078,3081],{"href":3079,"rel":3080},"https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fdevguides\u002Freporting\u002Fdata\u002Fv1\u002Fadvanced#cohort_report_examples",[36],"Google provides"," sample queries with explanations and visual representation.",[81,3084,3086],{"id":3085},"pagination","Pagination",[11,3088,3089,3090,3093,3094,3097,3098,3100],{},"By default, the query returns (up to) 10 rows of the results. This can be increased using the limit parameter of up to 10,000 rows of returned results. If you need to query more rows, you can combine the ",[105,3091,3092],{},"limit"," parameter with the parameter ",[105,3095,3096],{},"offset"," which specifies from which index the results should be displayed. Therefore, if the ",[105,3099,1187],{}," in the results show that you have over 10,000 resulting rows, you need to run the query first with the following parameters to query the first 10,000 rows:",[11,3102,3103],{},[105,3104,3105],{},"{… \"limit\": 10000, \"offset\": 0}",[11,3107,3108],{},"and next, with offset set to 10,000 to query rows starting with the row index 10,001:",[11,3110,3111],{},[105,3112,3113],{},"{… \"limit\": 10000, \"offset\": 10000}",[64,3115,3117],{"id":3116},"multiple-queries","Multiple queries",[11,3119,3120,3121,3124,3125,3127],{},"To run multiple requests together, you need to use the ",[15,3122,3123],{},"batchRunReports"," method instead of the ",[15,3126,73],{}," method. This works in a similar way as constructing multiple requests for the original API, which means that the requests are all included in an array within an outer object. Inside they have the same structure as if they were single requests.",[11,3129,3130],{},"As an example, we present a set of queries where the first query extracts the number of sessions within several days and the other on total sessions in the previous month. These queries can be used to compare the current sessions with the daily average in the last month. This example is selected for its simplicity; however, the concept can be used in a broad variety of cases, including comparison of data query to its filtered counterpart or comparison of multiple time periods that cannot be represented by a single dimension.",[140,3132,3134],{"className":142,"code":3133,"language":144,"meta":145,"style":145},"{\n    \"requests\": [\n        {\n            \"dateRanges\": [\n                {\n                    \"startDate\": \"2021-01-04\",\n                    \"endDate\": \"2021-01-06\"\n                }\n            ],\n            \"metrics\": [\n                {\n                    \"name\": \"sessions\"\n                }\n            ],\n            \"dimensions\": [\n                {\n                    \"name\": \"date\"\n                }\n            ],\n            \"orderBys\": [\n                {\n                    \"metric\": {\n                        \"metricName\": \"sessions\"\n                    },\n                    \"desc\": true\n                }\n            ]\n        },\n        {\n            \"dateRanges\": [\n                {\n                    \"startDate\": \"2020-12-01\",\n                    \"endDate\": \"2020-12-31\"\n                }\n            ],\n            \"metrics\": [\n                {\n                    \"name\": \"sessions\"\n                }\n            ]\n        }\n    ]\n }\n",[105,3135,3136,3140,3153,3157,3169,3173,3191,3207,3211,3215,3227,3231,3247,3251,3255,3267,3271,3287,3291,3295,3307,3311,3323,3339,3343,3355,3359,3363,3368,3372,3384,3388,3407,3424,3428,3432,3444,3448,3464,3468,3472,3476,3481],{"__ignoreMap":145},[149,3137,3138],{"class":151,"line":152},[149,3139,156],{"class":155},[149,3141,3142,3144,3147,3149,3151],{"class":151,"line":159},[149,3143,1218],{"class":155},[149,3145,3146],{"class":165},"requests",[149,3148,169],{"class":155},[149,3150,172],{"class":155},[149,3152,175],{"class":155},[149,3154,3155],{"class":151,"line":178},[149,3156,838],{"class":155},[149,3158,3159,3161,3163,3165,3167],{"class":151,"line":184},[149,3160,1267],{"class":155},[149,3162,166],{"class":190},[149,3164,169],{"class":155},[149,3166,172],{"class":155},[149,3168,175],{"class":155},[149,3170,3171],{"class":151,"line":210},[149,3172,2103],{"class":155},[149,3174,3175,3177,3179,3181,3183,3185,3187,3189],{"class":151,"line":230},[149,3176,1282],{"class":155},[149,3178,191],{"class":375},[149,3180,169],{"class":155},[149,3182,172],{"class":155},[149,3184,198],{"class":155},[149,3186,202],{"class":201},[149,3188,169],{"class":155},[149,3190,207],{"class":155},[149,3192,3193,3195,3197,3199,3201,3203,3205],{"class":151,"line":236},[149,3194,1282],{"class":155},[149,3196,215],{"class":375},[149,3198,169],{"class":155},[149,3200,172],{"class":155},[149,3202,198],{"class":155},[149,3204,224],{"class":201},[149,3206,227],{"class":155},[149,3208,3209],{"class":151,"line":242},[149,3210,1319],{"class":155},[149,3212,3213],{"class":151,"line":256},[149,3214,2998],{"class":155},[149,3216,3217,3219,3221,3223,3225],{"class":151,"line":261},[149,3218,1267],{"class":155},[149,3220,247],{"class":190},[149,3222,169],{"class":155},[149,3224,172],{"class":155},[149,3226,175],{"class":155},[149,3228,3229],{"class":151,"line":279},[149,3230,2103],{"class":155},[149,3232,3233,3235,3237,3239,3241,3243,3245],{"class":151,"line":284},[149,3234,1282],{"class":155},[149,3236,107],{"class":375},[149,3238,169],{"class":155},[149,3240,172],{"class":155},[149,3242,198],{"class":155},[149,3244,274],{"class":201},[149,3246,227],{"class":155},[149,3248,3249],{"class":151,"line":289},[149,3250,1319],{"class":155},[149,3252,3253],{"class":151,"line":303},[149,3254,2998],{"class":155},[149,3256,3257,3259,3261,3263,3265],{"class":151,"line":308},[149,3258,1267],{"class":155},[149,3260,294],{"class":190},[149,3262,169],{"class":155},[149,3264,172],{"class":155},[149,3266,175],{"class":155},[149,3268,3269],{"class":151,"line":326},[149,3270,2103],{"class":155},[149,3272,3273,3275,3277,3279,3281,3283,3285],{"class":151,"line":331},[149,3274,1282],{"class":155},[149,3276,107],{"class":375},[149,3278,169],{"class":155},[149,3280,172],{"class":155},[149,3282,198],{"class":155},[149,3284,321],{"class":201},[149,3286,227],{"class":155},[149,3288,3289],{"class":151,"line":336},[149,3290,1319],{"class":155},[149,3292,3293],{"class":151,"line":349},[149,3294,2998],{"class":155},[149,3296,3297,3299,3301,3303,3305],{"class":151,"line":354},[149,3298,1267],{"class":155},[149,3300,121],{"class":190},[149,3302,169],{"class":155},[149,3304,172],{"class":155},[149,3306,175],{"class":155},[149,3308,3309],{"class":151,"line":369},[149,3310,2103],{"class":155},[149,3312,3313,3315,3317,3319,3321],{"class":151,"line":389},[149,3314,1282],{"class":155},[149,3316,359],{"class":375},[149,3318,169],{"class":155},[149,3320,172],{"class":155},[149,3322,366],{"class":155},[149,3324,3325,3327,3329,3331,3333,3335,3337],{"class":151,"line":395},[149,3326,1395],{"class":155},[149,3328,376],{"class":1285},[149,3330,169],{"class":155},[149,3332,172],{"class":155},[149,3334,198],{"class":155},[149,3336,274],{"class":201},[149,3338,227],{"class":155},[149,3340,3341],{"class":151,"line":410},[149,3342,2155],{"class":155},[149,3344,3345,3347,3349,3351,3353],{"class":151,"line":415},[149,3346,1282],{"class":155},[149,3348,400],{"class":375},[149,3350,169],{"class":155},[149,3352,172],{"class":155},[149,3354,407],{"class":155},[149,3356,3357],{"class":151,"line":421},[149,3358,1319],{"class":155},[149,3360,3361],{"class":151,"line":963},[149,3362,1324],{"class":155},[149,3364,3365],{"class":151,"line":976},[149,3366,3367],{"class":155},"        },\n",[149,3369,3370],{"class":151,"line":981},[149,3371,838],{"class":155},[149,3373,3374,3376,3378,3380,3382],{"class":151,"line":999},[149,3375,1267],{"class":155},[149,3377,166],{"class":190},[149,3379,169],{"class":155},[149,3381,172],{"class":155},[149,3383,175],{"class":155},[149,3385,3386],{"class":151,"line":1004},[149,3387,2103],{"class":155},[149,3389,3390,3392,3394,3396,3398,3400,3403,3405],{"class":151,"line":1009},[149,3391,1282],{"class":155},[149,3393,191],{"class":375},[149,3395,169],{"class":155},[149,3397,172],{"class":155},[149,3399,198],{"class":155},[149,3401,3402],{"class":201},"2020-12-01",[149,3404,169],{"class":155},[149,3406,207],{"class":155},[149,3408,3409,3411,3413,3415,3417,3419,3422],{"class":151,"line":1014},[149,3410,1282],{"class":155},[149,3412,215],{"class":375},[149,3414,169],{"class":155},[149,3416,172],{"class":155},[149,3418,198],{"class":155},[149,3420,3421],{"class":201},"2020-12-31",[149,3423,227],{"class":155},[149,3425,3426],{"class":151,"line":1019},[149,3427,1319],{"class":155},[149,3429,3430],{"class":151,"line":1032},[149,3431,2998],{"class":155},[149,3433,3434,3436,3438,3440,3442],{"class":151,"line":1037},[149,3435,1267],{"class":155},[149,3437,247],{"class":190},[149,3439,169],{"class":155},[149,3441,172],{"class":155},[149,3443,175],{"class":155},[149,3445,3446],{"class":151,"line":1055},[149,3447,2103],{"class":155},[149,3449,3450,3452,3454,3456,3458,3460,3462],{"class":151,"line":1060},[149,3451,1282],{"class":155},[149,3453,107],{"class":375},[149,3455,169],{"class":155},[149,3457,172],{"class":155},[149,3459,198],{"class":155},[149,3461,274],{"class":201},[149,3463,227],{"class":155},[149,3465,3466],{"class":151,"line":1065},[149,3467,1319],{"class":155},[149,3469,3470],{"class":151,"line":1078},[149,3471,1324],{"class":155},[149,3473,3474],{"class":151,"line":1083},[149,3475,862],{"class":155},[149,3477,3478],{"class":151,"line":1101},[149,3479,3480],{"class":155},"    ]\n",[149,3482,3483],{"class":151,"line":1106},[149,3484,3485],{"class":155}," }\n",[64,3487,3489],{"id":3488},"pivot-queries","Pivot queries",[11,3491,3492,3493,3497,3498,3501,3502,3505],{},"Similar to cohorts’ analysis, the possibility to run pivot queries was already introduced with version 4 of the original API. More about the use of pivots in the original API can be found in our already mentioned ",[32,3494,3496],{"href":34,"rel":3495},[36],"article on the original API version v4",". In GA4 API, pivots can be obtained using either ",[15,3499,3500],{},"runPivotReport"," (for a single request) or ",[15,3503,3504],{},"batchRunPivotReports"," (for multiple requests) methods.",[11,3507,3508],{},"Querying data as a pivot table is useful for dividing resulting values by further characteristics to view them from a different angle. For example, you can observe a number of errors per day using a simple query, but a pivot table allows you to extend the view by the browser they occurred in.",[11,3510,3511],{},"The structure is different from the structure in the original API, both for the queries and for the results, because the approach to pivot queries has changed. In the original API, you extend a simple query by a pivot table so that in the results, you can see both the simple query results and for each row of the results you can match the corresponding row of the pivot table. This is useful as it gives you aggregate results for each row of the pivot table. However, it also complicates the structure and the extraction of the data from the results.",[11,3513,3514,3515,3518,3519,3522,3523,3525,3526,3529,3530,3532,3533,3535],{},"In the GA4 API you can only extract the pivot table by itself (not in combination with the un-pivoted table as in the original API). The results that you receive are not in the structure of a pivot table, in fact, the results’ rows have the same content as if you did not query a pivot table. However, the key addition is the ",[105,3516,3517],{},"pivotHeader"," which allows the data to be transformed into the required pivot table. It uses the fact that data can be easily transformed between the classical and pivot formats, you just need to know the list of all values or combinations of values to construct the columns and then you can fill in the values. The shape of the pivot table is determined by the way you distribute the dimensions’ names into the ",[105,3520,3521],{},"pivots"," parameter array. The ",[105,3524,3517],{}," gives you the combination of values for those dimensions that you write together within ",[105,3527,3528],{},"fieldNames"," parameter of one item of the ",[105,3531,3521],{}," array and it gives you a list of values for single dimensions inside one item of the ",[105,3534,3521],{}," array. At the moment, it is up to you to construct the pivot table from these indicators.",[140,3537,3539],{"className":142,"code":3538,"language":144,"meta":145,"style":145},"{\n   \"dimensions\": [\n     {\n       \"name\": \"date\"\n     },\n     {\n       \"name\": \"deviceCategory\"\n     }\n   ],\n   \"metrics\": [\n     {\n       \"name\": \"sessions\"\n     }\n   ],\n   \"dateRanges\": [\n     {\n       \"startDate\": \"2021-01-04\",\n       \"endDate\": \"2021-01-06\"\n     }\n   ],\n   \"pivots\": [\n     {\n       \"fieldNames\": [\n         \"deviceCategory\"\n       ]\n     },\n    {\n       \"fieldNames\": [\n         \"date\"\n       ]\n     }\n   ]\n }\n",[105,3540,3541,3545,3558,3563,3580,3585,3589,3605,3610,3615,3627,3631,3647,3651,3655,3667,3671,3689,3705,3709,3713,3725,3729,3741,3750,3755,3759,3763,3775,3783,3787,3791,3796],{"__ignoreMap":145},[149,3542,3543],{"class":151,"line":152},[149,3544,156],{"class":155},[149,3546,3547,3550,3552,3554,3556],{"class":151,"line":159},[149,3548,3549],{"class":155},"   \"",[149,3551,294],{"class":165},[149,3553,169],{"class":155},[149,3555,172],{"class":155},[149,3557,175],{"class":155},[149,3559,3560],{"class":151,"line":178},[149,3561,3562],{"class":155},"     {\n",[149,3564,3565,3568,3570,3572,3574,3576,3578],{"class":151,"line":184},[149,3566,3567],{"class":155},"       \"",[149,3569,107],{"class":190},[149,3571,169],{"class":155},[149,3573,172],{"class":155},[149,3575,198],{"class":155},[149,3577,321],{"class":201},[149,3579,227],{"class":155},[149,3581,3582],{"class":151,"line":210},[149,3583,3584],{"class":155},"     },\n",[149,3586,3587],{"class":151,"line":230},[149,3588,3562],{"class":155},[149,3590,3591,3593,3595,3597,3599,3601,3603],{"class":151,"line":236},[149,3592,3567],{"class":155},[149,3594,107],{"class":190},[149,3596,169],{"class":155},[149,3598,172],{"class":155},[149,3600,198],{"class":155},[149,3602,2170],{"class":201},[149,3604,227],{"class":155},[149,3606,3607],{"class":151,"line":242},[149,3608,3609],{"class":155},"     }\n",[149,3611,3612],{"class":151,"line":256},[149,3613,3614],{"class":155},"   ],\n",[149,3616,3617,3619,3621,3623,3625],{"class":151,"line":261},[149,3618,3549],{"class":155},[149,3620,247],{"class":165},[149,3622,169],{"class":155},[149,3624,172],{"class":155},[149,3626,175],{"class":155},[149,3628,3629],{"class":151,"line":279},[149,3630,3562],{"class":155},[149,3632,3633,3635,3637,3639,3641,3643,3645],{"class":151,"line":284},[149,3634,3567],{"class":155},[149,3636,107],{"class":190},[149,3638,169],{"class":155},[149,3640,172],{"class":155},[149,3642,198],{"class":155},[149,3644,274],{"class":201},[149,3646,227],{"class":155},[149,3648,3649],{"class":151,"line":289},[149,3650,3609],{"class":155},[149,3652,3653],{"class":151,"line":303},[149,3654,3614],{"class":155},[149,3656,3657,3659,3661,3663,3665],{"class":151,"line":308},[149,3658,3549],{"class":155},[149,3660,166],{"class":165},[149,3662,169],{"class":155},[149,3664,172],{"class":155},[149,3666,175],{"class":155},[149,3668,3669],{"class":151,"line":326},[149,3670,3562],{"class":155},[149,3672,3673,3675,3677,3679,3681,3683,3685,3687],{"class":151,"line":331},[149,3674,3567],{"class":155},[149,3676,191],{"class":190},[149,3678,169],{"class":155},[149,3680,172],{"class":155},[149,3682,198],{"class":155},[149,3684,202],{"class":201},[149,3686,169],{"class":155},[149,3688,207],{"class":155},[149,3690,3691,3693,3695,3697,3699,3701,3703],{"class":151,"line":336},[149,3692,3567],{"class":155},[149,3694,215],{"class":190},[149,3696,169],{"class":155},[149,3698,172],{"class":155},[149,3700,198],{"class":155},[149,3702,224],{"class":201},[149,3704,227],{"class":155},[149,3706,3707],{"class":151,"line":349},[149,3708,3609],{"class":155},[149,3710,3711],{"class":151,"line":354},[149,3712,3614],{"class":155},[149,3714,3715,3717,3719,3721,3723],{"class":151,"line":369},[149,3716,3549],{"class":155},[149,3718,3521],{"class":165},[149,3720,169],{"class":155},[149,3722,172],{"class":155},[149,3724,175],{"class":155},[149,3726,3727],{"class":151,"line":389},[149,3728,3562],{"class":155},[149,3730,3731,3733,3735,3737,3739],{"class":151,"line":395},[149,3732,3567],{"class":155},[149,3734,3528],{"class":190},[149,3736,169],{"class":155},[149,3738,172],{"class":155},[149,3740,175],{"class":155},[149,3742,3743,3746,3748],{"class":151,"line":410},[149,3744,3745],{"class":155},"         \"",[149,3747,2170],{"class":201},[149,3749,227],{"class":155},[149,3751,3752],{"class":151,"line":415},[149,3753,3754],{"class":155},"       ]\n",[149,3756,3757],{"class":151,"line":421},[149,3758,3584],{"class":155},[149,3760,3761],{"class":151,"line":963},[149,3762,181],{"class":155},[149,3764,3765,3767,3769,3771,3773],{"class":151,"line":976},[149,3766,3567],{"class":155},[149,3768,3528],{"class":190},[149,3770,169],{"class":155},[149,3772,172],{"class":155},[149,3774,175],{"class":155},[149,3776,3777,3779,3781],{"class":151,"line":981},[149,3778,3745],{"class":155},[149,3780,321],{"class":201},[149,3782,227],{"class":155},[149,3784,3785],{"class":151,"line":999},[149,3786,3754],{"class":155},[149,3788,3789],{"class":151,"line":1004},[149,3790,3609],{"class":155},[149,3792,3793],{"class":151,"line":1009},[149,3794,3795],{"class":155},"   ]\n",[149,3797,3798],{"class":151,"line":1014},[149,3799,3485],{"class":155},[3801,3802,3803],"figure",{},[3804,3805,3806,3824],"table",{},[3807,3808,3809],"thead",{},[3810,3811,3812,3815,3818,3821],"tr",{},[3813,3814,321],"th",{},[3813,3816,3817],{},"desktop",[3813,3819,3820],{},"mobile",[3813,3822,3823],{},"tablet",[3825,3826,3827,3841,3855],"tbody",{},[3810,3828,3829,3832,3835,3838],{},[3830,3831,202],"td",{},[3830,3833,3834],{},"1230",[3830,3836,3837],{},"990",[3830,3839,3840],{},"210",[3810,3842,3843,3846,3849,3852],{},[3830,3844,3845],{},"2021-01-05",[3830,3847,3848],{},"1410",[3830,3850,3851],{},"1280",[3830,3853,3854],{},"150",[3810,3856,3857,3859,3862,3865],{},[3830,3858,224],{},[3830,3860,3861],{},"1370",[3830,3863,3864],{},"1290",[3830,3866,3867],{},"180",[11,3869,3870],{},[2536,3871],{"alt":145,"src":3872,"title":3873},"\u002Fupload\u002Fdata-results.webp","Data Results",[64,3875,3877],{"id":3876},"python-example","Python example",[11,3879,3880],{},"Until now we have talked about the JSON-structured queries used in the request body of cURL, HTTP, or JavaScript requests. However, it is possible to run the requests in Python as well, using Google Python library called google-analytics-data. The run of the Python code requires receiving a path to an access token for the service account and GA4 property ID to which this service account has access.",[11,3882,3883,3884,3887,3888,3891],{},"We include a sample code along with information on how to prepare your environment. To run the Python code, you need to first set up a virtual environment, then prepare a file with a path to an access token for the service account, and then you can run the Python code which will ask you to input the ",[105,3885,3886],{},"property_id"," as an argument. For the setup on Windows, run the code below in Command Prompt. Replace the place holder ",[105,3889,3890],{},"\u003Cyour-env>"," with the selected name for your environment.",[140,3893,3897],{"className":3894,"code":3895,"language":3896,"meta":145,"style":145},"language-powershell shiki shiki-themes material-theme-ocean","pip install virtualenv\n  virtualenv \u003Cyour-env>\n  \u003Cyour-env>\\Scripts\\activate\n  \u003Cyour-env>\\Scripts\\pip.exe install google-analytics-data pandas python-dotenv\n","powershell",[105,3898,3899,3904,3909,3914],{"__ignoreMap":145},[149,3900,3901],{"class":151,"line":152},[149,3902,3903],{},"pip install virtualenv\n",[149,3905,3906],{"class":151,"line":159},[149,3907,3908],{},"  virtualenv \u003Cyour-env>\n",[149,3910,3911],{"class":151,"line":178},[149,3912,3913],{},"  \u003Cyour-env>\\Scripts\\activate\n",[149,3915,3916],{"class":151,"line":184},[149,3917,3918],{},"  \u003Cyour-env>\\Scripts\\pip.exe install google-analytics-data pandas python-dotenv\n",[11,3920,3921,3922,3925],{},"To prepare the access to data, you need to have a service account that has access to the GA4 property data. The local path needs to be saved under the parameter ",[105,3923,3924],{},"SERVICE_TOKEN_PATH"," in .env file which is located in the same folder as the Python code. The format of the file should be as follows:",[140,3927,3929],{"className":3894,"code":3928,"language":3896,"meta":145,"style":145},"SERVICE_TOKEN_PATH=\"C:\u002FUsers\u002FYourUser\u002FDocuments\u002Fservice_account_token.json\"\n",[105,3930,3931],{"__ignoreMap":145},[149,3932,3933],{"class":151,"line":152},[149,3934,3928],{},[11,3936,3937,3938,3943],{},"If you need any help creating the service token, refer to ",[32,3939,3942],{"href":3940,"rel":3941},"https:\u002F\u002Fcloud.google.com\u002Fiam\u002Fdocs\u002Fcreating-managing-service-accounts.",[36],"official documents",".",[11,3945,3946,3947,3943],{},"When you have set up the virtual environment, prepare the .env file and set the GA4 property ID into the parameter property_id, you can run the Python code to obtain the sample results. The code loads and prints data about active users and a number of sessions by the date, country, and city characteristics, since the beginning of the year 2021. For more information about the library, you can ",[32,3948,3951],{"href":3949,"rel":3950},"https:\u002F\u002Fgithub.com\u002Fgoogleapis\u002Fpython-analytics-data",[36],"check the client library source code",[140,3953,3957],{"className":3954,"code":3955,"language":3956,"meta":145,"style":145},"language-py shiki shiki-themes material-theme-ocean","    from dotenv import load_dotenv\n    import os\n    import json\n    import pandas as pd\n    from google.analytics.data_v1beta import BetaAnalyticsDataClient\n    from google.analytics.data_v1beta.types import DateRange, Dimension, Metric, RunReportRequest\n    \n    # Setting \n    #(.env file is located in the same location and contains SERVICE_TOKEN_PATH=[local-path-to-Google-service-token-with-data-access])\n    load_dotenv()\n    SERVICE_TOKEN_PATH = os.getenv('SERVICE_TOKEN_PATH')\n    property_id = '\u003Cset-your-property-ID-here>'\n    \n    def sample_run_report(property_id):\n        \"\"\"Runs a simple report on a Google Analytics 4 property.\"\"\"\n    \n        client = AlphaAnalyticsDataClient.from_service_account_file(SERVICE_TOKEN_PATH)\n        request = RunReportRequest(property=f\"properties\u002F{​property_id}​\",\n                                   dimensions=[Dimension(name='date'), Dimension(name='country'), Dimension(name='city')],\n                                   metrics=[Metric(name='activeUsers'), Metric(name='sessions')],\n                                   date_ranges=[DateRange(start_date='2021-01-01', end_date='yesterday')])\n        response = client.run_report(request)\n        return response\n    \n    def sample_extract_data(response):\n        \"\"\"Extracts data from GA 4 Data API response as Pandas Dataframe \"\"\"\n        data_dict = {}\n        for row in response.rows:\n                data_dict_row = []\n                for i in range(len(row.dimension_values)):\n                    data_dict_row.append(row.dimension_values[i].value)\n                for j in range(len(row.metric_values)):\n                    data_dict_row.append(row.metric_values[j].value)\n                data_dict[response.rows.index(row)] = data_dict_row\n    \n        columns_list = []\n        for dim_header in response.dimension_headers:\n            columns_list.append(dim_header.name)\n        for met_header in response.metric_headers:\n            columns_list.append(met_header.name)\n        return pd.DataFrame.from_dict(data_dict, orient='index', columns = columns_list)\n    \n    \n    if __name__ == \"__main__\":\n        query_response = sample_run_report(property_id)\n        sample_extract_data(query_response)\n","py",[105,3958,3959,3964,3969,3974,3979,3984,3989,3994,3999,4004,4009,4014,4019,4023,4028,4033,4037,4042,4047,4052,4057,4062,4067,4072,4076,4081,4086,4091,4096,4101,4106,4111,4116,4121,4126,4130,4135,4140,4145,4150,4155,4160,4164,4168,4173,4178],{"__ignoreMap":145},[149,3960,3961],{"class":151,"line":152},[149,3962,3963],{},"    from dotenv import load_dotenv\n",[149,3965,3966],{"class":151,"line":159},[149,3967,3968],{},"    import os\n",[149,3970,3971],{"class":151,"line":178},[149,3972,3973],{},"    import json\n",[149,3975,3976],{"class":151,"line":184},[149,3977,3978],{},"    import pandas as pd\n",[149,3980,3981],{"class":151,"line":210},[149,3982,3983],{},"    from google.analytics.data_v1beta import BetaAnalyticsDataClient\n",[149,3985,3986],{"class":151,"line":230},[149,3987,3988],{},"    from google.analytics.data_v1beta.types import DateRange, Dimension, Metric, RunReportRequest\n",[149,3990,3991],{"class":151,"line":236},[149,3992,3993],{},"    \n",[149,3995,3996],{"class":151,"line":242},[149,3997,3998],{},"    # Setting \n",[149,4000,4001],{"class":151,"line":256},[149,4002,4003],{},"    #(.env file is located in the same location and contains SERVICE_TOKEN_PATH=[local-path-to-Google-service-token-with-data-access])\n",[149,4005,4006],{"class":151,"line":261},[149,4007,4008],{},"    load_dotenv()\n",[149,4010,4011],{"class":151,"line":279},[149,4012,4013],{},"    SERVICE_TOKEN_PATH = os.getenv('SERVICE_TOKEN_PATH')\n",[149,4015,4016],{"class":151,"line":284},[149,4017,4018],{},"    property_id = '\u003Cset-your-property-ID-here>'\n",[149,4020,4021],{"class":151,"line":289},[149,4022,3993],{},[149,4024,4025],{"class":151,"line":303},[149,4026,4027],{},"    def sample_run_report(property_id):\n",[149,4029,4030],{"class":151,"line":308},[149,4031,4032],{},"        \"\"\"Runs a simple report on a Google Analytics 4 property.\"\"\"\n",[149,4034,4035],{"class":151,"line":326},[149,4036,3993],{},[149,4038,4039],{"class":151,"line":331},[149,4040,4041],{},"        client = AlphaAnalyticsDataClient.from_service_account_file(SERVICE_TOKEN_PATH)\n",[149,4043,4044],{"class":151,"line":336},[149,4045,4046],{},"        request = RunReportRequest(property=f\"properties\u002F{​property_id}​\",\n",[149,4048,4049],{"class":151,"line":349},[149,4050,4051],{},"                                   dimensions=[Dimension(name='date'), Dimension(name='country'), Dimension(name='city')],\n",[149,4053,4054],{"class":151,"line":354},[149,4055,4056],{},"                                   metrics=[Metric(name='activeUsers'), Metric(name='sessions')],\n",[149,4058,4059],{"class":151,"line":369},[149,4060,4061],{},"                                   date_ranges=[DateRange(start_date='2021-01-01', end_date='yesterday')])\n",[149,4063,4064],{"class":151,"line":389},[149,4065,4066],{},"        response = client.run_report(request)\n",[149,4068,4069],{"class":151,"line":395},[149,4070,4071],{},"        return response\n",[149,4073,4074],{"class":151,"line":410},[149,4075,3993],{},[149,4077,4078],{"class":151,"line":415},[149,4079,4080],{},"    def sample_extract_data(response):\n",[149,4082,4083],{"class":151,"line":421},[149,4084,4085],{},"        \"\"\"Extracts data from GA 4 Data API response as Pandas Dataframe \"\"\"\n",[149,4087,4088],{"class":151,"line":963},[149,4089,4090],{},"        data_dict = {}\n",[149,4092,4093],{"class":151,"line":976},[149,4094,4095],{},"        for row in response.rows:\n",[149,4097,4098],{"class":151,"line":981},[149,4099,4100],{},"                data_dict_row = []\n",[149,4102,4103],{"class":151,"line":999},[149,4104,4105],{},"                for i in range(len(row.dimension_values)):\n",[149,4107,4108],{"class":151,"line":1004},[149,4109,4110],{},"                    data_dict_row.append(row.dimension_values[i].value)\n",[149,4112,4113],{"class":151,"line":1009},[149,4114,4115],{},"                for j in range(len(row.metric_values)):\n",[149,4117,4118],{"class":151,"line":1014},[149,4119,4120],{},"                    data_dict_row.append(row.metric_values[j].value)\n",[149,4122,4123],{"class":151,"line":1019},[149,4124,4125],{},"                data_dict[response.rows.index(row)] = data_dict_row\n",[149,4127,4128],{"class":151,"line":1032},[149,4129,3993],{},[149,4131,4132],{"class":151,"line":1037},[149,4133,4134],{},"        columns_list = []\n",[149,4136,4137],{"class":151,"line":1055},[149,4138,4139],{},"        for dim_header in response.dimension_headers:\n",[149,4141,4142],{"class":151,"line":1060},[149,4143,4144],{},"            columns_list.append(dim_header.name)\n",[149,4146,4147],{"class":151,"line":1065},[149,4148,4149],{},"        for met_header in response.metric_headers:\n",[149,4151,4152],{"class":151,"line":1078},[149,4153,4154],{},"            columns_list.append(met_header.name)\n",[149,4156,4157],{"class":151,"line":1083},[149,4158,4159],{},"        return pd.DataFrame.from_dict(data_dict, orient='index', columns = columns_list)\n",[149,4161,4162],{"class":151,"line":1101},[149,4163,3993],{},[149,4165,4166],{"class":151,"line":1106},[149,4167,3993],{},[149,4169,4170],{"class":151,"line":1111},[149,4171,4172],{},"    if __name__ == \"__main__\":\n",[149,4174,4175],{"class":151,"line":1116},[149,4176,4177],{},"        query_response = sample_run_report(property_id)\n",[149,4179,4180],{"class":151,"line":1121},[149,4181,4182],{},"        sample_extract_data(query_response)\n",[64,4184,4186],{"id":4185},"summary","Summary",[11,4188,4189],{},"The newly published Google Analytics Data API is constructed to query data from Google Analytics 4. In this article, we summarized its similarities and differences to the GA Reporting API v4 for Universal Analytics. The basic parameters and results’ structure are very similar between these approaches but there are some new features introduced (like Quotas report) and there are several steps towards consistency between dimensions and metrics and between different types of queries. Thus, the GA Data API does not seem to be very difficult to transition to and at the same time, it brings the unique experience of working with the new Google Analytics.",[28,4191,4192,4193,4197,4198,4197,4202,4197,4206,4210,4211,4216],{},"\nMore information about the methods is provided in official Google’s documentation on the GA4 API (\n",[32,4194,73],{"href":4195,"rel":4196},"https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fdevguides\u002Freporting\u002Fdata\u002Fv1\u002Frest\u002Fv1beta\u002Fproperties\u002FrunReport",[36],"\n, \n",[32,4199,3500],{"href":4200,"rel":4201},"https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fdevguides\u002Freporting\u002Fdata\u002Fv1\u002Frest\u002Fv1beta\u002Fproperties\u002FrunPivotReport",[36],[32,4203,3123],{"href":4204,"rel":4205},"https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fdevguides\u002Freporting\u002Fdata\u002Fv1\u002Frest\u002Fv1beta\u002Fproperties\u002FbatchRunReports",[36],[32,4207,3504],{"href":4208,"rel":4209},"https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fdevguides\u002Freporting\u002Fdata\u002Fv1\u002Frest\u002Fv1beta\u002Fproperties\u002FbatchRunPivotReports",[36],"\n) where you can also run the queries in the API Explorer. For easier use, Google provides a comprehensive \n",[32,4212,4215],{"href":4213,"rel":4214},"https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fdevguides\u002Freporting\u002Fdata\u002Fv1\u002Fapi-schema",[36],"list","\n of all currently available dimensions and metrics.\n",[4218,4219,4222],"action",{"link":4220,"button":4221},"\u002Fen\u002Fget-in-touch\u002F","Contact Us","\n Our methodology has successfully revealed and corrected the data issue and supported the accuracy of the evaluation for multiple clients. Contact us for more information. We can ensure the accuracy of your A\u002FB testing too. \n",[4224,4225,4226],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .sAklC, html code.shiki .sAklC{--shiki-default:#89DDFF}html pre.shiki code .sJ14y, html code.shiki .sJ14y{--shiki-default:#C792EA}html pre.shiki code .s5Dmg, html code.shiki .s5Dmg{--shiki-default:#FFCB6B}html pre.shiki code .sfyAc, html code.shiki .sfyAc{--shiki-default:#C3E88D}html pre.shiki code .sx098, html code.shiki .sx098{--shiki-default:#F78C6C}html pre.shiki code .s-wAU, html code.shiki .s-wAU{--shiki-default:#F07178}html pre.shiki code .s0W1g, html code.shiki .s0W1g{--shiki-default:#BABED8}html pre.shiki code .s9WhI, html code.shiki .s9WhI{--shiki-default:#916B53}html pre.shiki code .sdLwU, html code.shiki .sdLwU{--shiki-default:#82AAFF}html pre.shiki code .sbqyR, html code.shiki .sbqyR{--shiki-default:#FF9CAC}",{"title":145,"searchDepth":159,"depth":159,"links":4228},[4229,4233,4239,4240,4241,4242],{"id":66,"depth":159,"text":67,"children":4230},[4231,4232],{"id":83,"depth":178,"text":86},{"id":683,"depth":178,"text":684},{"id":1720,"depth":159,"text":1721,"children":4234},[4235,4236,4237,4238],{"id":1724,"depth":178,"text":1725},{"id":1963,"depth":178,"text":1964},{"id":2510,"depth":178,"text":2511},{"id":3085,"depth":178,"text":3086},{"id":3116,"depth":159,"text":3117},{"id":3488,"depth":159,"text":3489},{"id":3876,"depth":159,"text":3877},{"id":4185,"depth":159,"text":4186},"The new version of Google Analytics with an innovative approach to data structure has been introduced in summer 2019, under the name Google Analytics App + Web. In autumn 2020 Google released it from the beta version and rebranded it as Google Analytics 4. While it is still not recommended to transfer your whole data measurement to the new version as it is being gradually improved, it definitely deserves increased attention as Google is introducing many new features there. The new Google Analytics 4 is based on events and their parameters. As its previous name implies, it combines data from apps and web analytics in one property. Moreover, it serves as a flexible tool for cross-platform analysis. To learn more about Google Analytics 4, follow our blog for an upcoming article in which we will discuss changes and new features of the GA4, extensively.","md","\u002Fupload\u002Fga4-api-banner.webp",false,{},"Do you need to migrate from Universal Analytics Reporting API to the new GA4 reporting API v1? A practical guide how to migrate to the new version.",true,"\u002Fen\u002Fblog\u002Fnew-data-api-for-google-analytics-4","2021-03-30T02:12:10.000+00:00",19.75,"20 min read",[4255,4256],"content\u002Fen\u002Fblog\u002Fnotes-on-new-features-of-google-analytics-reporting-api-v4.md","content\u002Fen\u002Fblog\u002Fdata-layer-validation-what-why-and-how.md",{"title":5,"description":4243},"en\u002Fblog\u002Fnew-data-api-for-google-analytics-4","Have you tried the new Google Analytics 4 (formerly App + Web) and want to learn more about its Data API? Are you wondering how to query the data measured using the new Google Analytics 4? We tested the Data API features for you and compared them to the currently used API for Universal Analytics.","2021-06-14T01:41:00.000+00:00","jQHyTtsGpkuGi2WT-38RuI0B19oxm1PhCoplxWK5deU",[4263,4461],{"id":4264,"title":4265,"author":6,"body":4266,"category":4447,"description":4270,"extension":4244,"image":4448,"isToc":4246,"langAlt":6,"meta":4449,"metaDescription":6,"navigation":4249,"path":4450,"published":4249,"publishedAt":4451,"readingTimeMinutes":4452,"readingTimeText":4453,"relatedArticles":4454,"seo":4457,"stem":4458,"teaser":4459,"updatedAtCustom":6,"__hash__":4460},"blog_en\u002Fen\u002Fblog\u002Fdata-layer-validation-what-why-and-how.md","Data layer Validation – what, why, and how",{"type":8,"value":4267,"toc":4434},[4268,4271,4275,4282,4285,4293,4296,4299,4304,4308,4311,4314,4318,4321,4325,4328,4332,4335,4339,4342,4350,4354,4357,4362,4374,4378,4395,4398,4402,4410,4419,4426],[11,4269,4270],{},"In the world of information, relevant and accurate data make the difference, especially in saturated markets. Understanding your customers and delivering the best digital experience helps to build lasting relationships and increasing customer lifetime value (CLV). In order to extract the required information on the customers from the website\u002F e-shop, and build new strategies of more effective communication, web tracking is indispensable. To set up well-working web tracking, you need to implement a data layer.",[64,4272,4274],{"id":4273},"what-is-a-data-layer","What is a data layer?",[11,4276,4277,4278,4281],{},"In case the term ",[45,4279,4280],{},"data layer"," is new to you or just not too familiar, explaining it as a JavaScript Object will not tell you much. However, do not be discouraged. Yes, you do need to go an extra mile to implement it, and some coding is needed (you may team up with developers or hire an agency), the long-term benefits are worth it all.",[11,4283,4284],{},"Here is a simple data layer in a raw view",[140,4286,4291],{"className":4287,"code":4289,"language":4290},[4288],"language-text","{\n    \"page\": {\n        \"type\": \"list\",\n        \"trail\": \"marketing\u002Farticles\",\n        \"list\": {\n            \"pageNumber\": 2,\n            \"filters\": {\n                \"years\": [\n                    \"2020\",\n                    \"2019\"\n                ],\n                \"keywords\": [\n                    \"affilates\",\n                    \"seo\"\n                ]\n            }\n        },\n        \"locale\": \"cs-CZ\",\n        \"currencyCode\": \"CZK\",\n        \"countryCode\": \"CZ\"\n    },\n    \"session\": {\n        \"machine\": \"external\",\n        \"deviceType\": \"mobile\",\n        \"env\": \"prod\"\n    },\n    \"user\": {\n        \"username\": \"tester123\",\n        \"id\": \"66oc39119520732e1s1f23ead6c57\",\n        \"segment\": \"customer.premium\",\n        \"transactionCount\": 2,\n        \"transactionValue\": 799.99\n    },\n    \"event\": \"page\"\n}\n","text",[105,4292,4289],{"__ignoreMap":145},[11,4294,4295],{},"Simply put, a data layer is a method of collecting and distributing data from your website. On the deeper and more technical level, a data layer is a complex structure behind the websites or mobile apps to extract timely and consistent visitor\u002Fuser information. It holds the data you need and sends it to other applications, preferably firstly to tag management system (TMS) and from there to other analytical and marketing platforms. This way, customer actions are translated into variables and dimensions. The type of data that is contained in the data layer depends on the business requirements, such as transaction, behavioral, demographic, device, and more. The more information and varieties you need, the more complex the data layer gets.",[11,4297,4298],{},"Dividing the process into layers:",[11,4300,4301],{},[2536,4302],{"alt":145,"src":4303},"\u002Fupload\u002Fdatalayerillustration.webp",[64,4305,4307],{"id":4306},"why-is-a-data-layer-a-must","Why is a data layer a must?",[11,4309,4310],{},"To maximize the potential of your website, get to know your audience, and provide more personalized content, you need relevancy, consistency, and accuracy of your data in all platforms. Starting from your web via a data layer. The benefits go way beyond just knowing how much. The quality of the data is what counts.",[11,4312,4313],{},"From the perspective of practically on the background, a data layer standardizes data across technologies (analytical and marketing) and the collection maintains consistency despite changes on the web. You may know that changes on any website can drastically throw off your tracking, and if you ever experienced a measurement problem you know that the impact is even more disastrous. The data layer helps to reduce development time and the number of iterations between the development and marketers when implementing new technologies.",[81,4315,4317],{"id":4316},"sounds-great-but","Sounds great, but …",[11,4319,4320],{},"As previously said, the data layer reduces time. However, as the website is not a static but a very dynamic environment, and even a small change can cause many mistakes. To prevent mistakes, you need to check for mistakes, which can seem too complicated and time-consuming. Manual control is one way, yet not very effective.",[64,4322,4324],{"id":4323},"data-layer-validation","Data layer validation",[11,4326,4327],{},"Data layer validation should come in regularly to prevent errors and sustain web measurement the way you want it. But forget the traditional method. Some tools can help you validate easier, or at least look into your data layer, row by row.",[81,4329,4331],{"id":4330},"experience-comes-in","Experience comes in",[11,4333,4334],{},"Validating one data layer of a smaller website takes time but it is manageable. Imagine validating 10 or 100 very complex e-shops. Then you start thinking of a better solution. First, research of available tools comes in. After some time, you realize it got you nowhere, or the options are just not sufficient. We went through all the steps and more deeply to figure out how to tackle this case.",[64,4336,4338],{"id":4337},"meet-waaila-tracking-validator","Meet Waaila Tracking Validator",[11,4340,4341],{},"After trials and failures, we decided to develop our own tool for data layer validation. We put our experience with writing data layer specifications, our clients’ needs, and user experience, and released a Chrome extension that can inspect and validate your data layer through particular events and pages, just like a customer would progress on the website, which makes it easier to spot errors and, not less important, easier for the developers to understand the data layer as well.",[11,4343,4344,4349],{},[32,4345,4348],{"href":4346,"rel":4347},"https:\u002F\u002Fwaaila.com\u002Fen\u002Ftracking-validator",[36],"Waaila Tracking Validator"," extension is using JSON Schema standard, checks if your data layer on the website corresponds with the structure of the data layer defined in your custom JSON schema, and looks for inconsistencies.",[81,4351,4353],{"id":4352},"waaila-tracking-validator-in-action","Waaila Tracking Validator in action",[11,4355,4356],{},"The tool allows you to validate the data layer against custom JSON schema and it is pretty simple to use. You insert the JSON schema into the tool, confirm, and start validating.",[4358,4359,4361],"h4",{"id":4360},"benefits","Benefits",[4363,4364,4365,4368,4371],"ul",{},[94,4366,4367],{},"Developed for analysts who create data layer specifications",[94,4369,4370],{},"Benefits the developers who often get lost in the data layer",[94,4372,4373],{},"Lowers the number of iterations",[4358,4375,4377],{"id":4376},"features","Features",[4363,4379,4380,4383,4386,4389,4392],{},[94,4381,4382],{},"Automatically validate the syntax of your data layer to easily detect various typos, such as lower\u002Fupper key, spaces, etc. that are very easily overlooked.",[94,4384,4385],{},"Semi-automatic validation of semantic. You need to manually choose the context of the web page, however, the validator automatically checks the data layer against the schema.",[94,4387,4388],{},"The exact location of the error in the data layer. Being able to see where exactly the error occurs and what problems it causes helps to understand general issues of the data layer, when not implemented correctly, and speed the process of retrieval.",[94,4390,4391],{},"Error highlighting proved to be very effective in the process of implementing changes into the data layer, especially when the developers do not understand the requirements, consequently decreasing the number of discussions among teams.",[94,4393,4394],{},"The tool is quick and responsive, the validation takes only a few seconds compared to long manual crawling.",[4218,4396,4397],{"link":4220,"button":4221},"\nWe can help you specify your data layer and implement digital measurement.\n",[81,4399,4401],{"id":4400},"got-you-hooked","Got you hooked?",[11,4403,4404,4405,3943],{},"Try the tool for free on ",[32,4406,4409],{"href":4407,"rel":4408},"https:\u002F\u002Fchrome.google.com\u002Fwebstore\u002Fdetail\u002Fwaaila-tracking-validator\u002Fjkmohgcefflkfjoemjnpigiokpjeohcl",[36],"Google Chrome store",[11,4411,4412,4413,4418],{},"Build your own ",[32,4414,4417],{"href":4415,"rel":4416},"https:\u002F\u002Fwaaila.com\u002Fen\u002Fdocs\u002Ftracking-validator\u002F",[36],"Validation schema",", and start validating the data layer instantly!",[11,4420,4421,4422,3943],{},"Find out more in-depth descriptions and the process in ",[32,4423,4425],{"href":4415,"rel":4424},[36],"the extensive documentation",[11,4427,4428,4433],{},[32,4429,4432],{"href":4430,"rel":4431},"https:\u002F\u002Fcrossmasters.com\u002Fen\u002Fblog\u002Fzoom-in-on-measurement-hub\u002F",[36],"Read more"," about the data layer implementation.",{"title":145,"searchDepth":159,"depth":159,"links":4435},[4436,4437,4440,4443],{"id":4273,"depth":159,"text":4274},{"id":4306,"depth":159,"text":4307,"children":4438},[4439],{"id":4316,"depth":178,"text":4317},{"id":4323,"depth":159,"text":4324,"children":4441},[4442],{"id":4330,"depth":178,"text":4331},{"id":4337,"depth":159,"text":4338,"children":4444},[4445,4446],{"id":4352,"depth":178,"text":4353},{"id":4400,"depth":178,"text":4401},"Products","\u002Fupload\u002Fdata-strategy-article-cover.webp",{},"\u002Fen\u002Fblog\u002Fdata-layer-validation-what-why-and-how","2020-10-07T01:26:03.000+00:00",5.535,"6 min read",[4455,4456],"content\u002Fen\u002Fblog\u002Fzoom-in-on-measurement-hub.md","content\u002Fen\u002Fblog\u002Fstarting-with-waaila.md",{"title":4265,"description":4270},"en\u002Fblog\u002Fdata-layer-validation-what-why-and-how","Many websites, especially e-shops underestimate the power of well-implemented data layer. Here is why and how you should make sure it is done right.","7nW396Sw7ENACMxQjmoUxQrG9x3N1nAbt07oOefXhPM",{"id":4462,"title":4463,"author":6,"body":4464,"category":6,"description":145,"extension":4244,"image":6477,"isToc":4246,"langAlt":6,"meta":6478,"metaDescription":6479,"navigation":4249,"path":6480,"published":4249,"publishedAt":6481,"readingTimeMinutes":6482,"readingTimeText":6483,"relatedArticles":6,"seo":6484,"stem":6485,"teaser":6479,"updatedAtCustom":6,"__hash__":6486},"blog_en\u002Fen\u002Fblog\u002Fnotes-on-new-features-of-google-analytics-reporting-api-v4.md","Notes on new features of Google Analytics Reporting API v4",{"type":8,"value":4465,"toc":6467},[4466,4473,4475,4481,4484,4487,4500,4504,4507,4528,4531,4535,4542,4603,4820,4824,4835,4838,4848,4851,4854,4859,5222,5226,5236,5239,5242,5461,5785,5789,5807,5881,6424,6428,6435,6442,6446,6449,6461,6464],[50,4467,4468,4469,38],{},"\nThis is the latest version of the legacy Google Analytics API. For GA4 API v1 read \n",[32,4470,4472],{"href":4471},"\u002Fen\u002Fblog\u002Fnew-data-api-for-google-analytics-4\u002F","this",[2003,4474],{},[11,4476,4477,4478,3943],{},"The current version of the Google Analytics Reporting API was introduced some time ago offering several new features in comparison to the previous version. While the API v3 is still going to be supported, it might be beneficial to consider using the newer API v4 as it presents several interesting cases. With the API v4, you can use the same structure of queries as before, however, you can benefit from the new features, which will help you ",[15,4479,4480],{},"access your data more efficiently",[11,4482,4483],{},"This summary describes the improvements in more detail – what is new in the v4 API and why it is beneficial. There are 4 main cases plus a few additional possibilities included in the current version of the Reporting API.",[11,4485,4486],{},"Special features we find the most beneficial:",[4363,4488,4489,4492,4495,4497],{},[94,4490,4491],{},"Metric expression",[94,4493,4494],{},"Histograms",[94,4496,2511],{},[94,4498,4499],{},"Pivot",[64,4501,4503],{"id":4502},"why-use-google-analytics-reporting-api-in-general","Why use Google Analytics Reporting API in general",[11,4505,4506],{},"The Google Analytics Reporting API is widely used as it is a part of the standard version of Google Analytics. It allows you to",[4363,4508,4509,4512,4515,4518,4521],{},[94,4510,4511],{},"Quickly obtain data for further processing and analysis",[94,4513,4514],{},"Reach data by querying from code (using authentication) or some advanced solution (e.g. Roivenue)",[94,4516,4517],{},"Explore data using many ready-made integrations (including the Query Explorer)",[94,4519,4520],{},"Save time by automating loading data and other reporting tasks",[94,4522,4523,4524,4527],{},"Use data in advanced data analytical programs (e.g. ",[32,4525,57],{"href":55,"rel":4526},[36],")",[11,4529,4530],{},"In short, the Google Analytics Reporting APIs are very useful, so let’s have a look at the current version.",[81,4532,4534],{"id":4533},"extended-metric-expression","Extended metric expression",[11,4536,4537,4538,4541],{},"To simplify data manipulation, it is now possible to input expressions of metrics instead of single metrics’ names only. In particular, to compare the Pages per Session ratio across multiple groups of customers or multiple days, it is sufficient to ",[15,4539,4540],{},"write the formula"," for the ratio within the metric expression field and the resulting data directly lets you compare the evolution of the ratio without the need to transform the data further. The expression allows basic operations. While there is a limit on the number of characters within the expression, the most used formulas should fit within. You can choose your name for the output of the expression which further increases the legibility of the output data. This helps to create easily understandable tables with a single query.",[3801,4543,4544],{},[3804,4545,4546,4556],{},[3807,4547,4548],{},[3810,4549,4550,4553],{},[3813,4551,4552],{},"Month of the year",[3813,4554,4555],{},"Pages per Session ratio",[3825,4557,4558,4566,4573,4581,4588,4596],{},[3810,4559,4560,4563],{},[3830,4561,4562],{},"01",[3830,4564,4565],{},"5",[3810,4567,4568,4571],{},[3830,4569,4570],{},"02",[3830,4572,4565],{},[3810,4574,4575,4578],{},[3830,4576,4577],{},"03",[3830,4579,4580],{},"6",[3810,4582,4583,4586],{},[3830,4584,4585],{},"04",[3830,4587,4565],{},[3810,4589,4590,4593],{},[3830,4591,4592],{},"05",[3830,4594,4595],{},"4",[3810,4597,4598,4601],{},[3830,4599,4600],{},"06",[3830,4602,4595],{},[140,4604,4606],{"className":142,"code":4605,"language":144,"meta":145,"style":145},"{\n  \"reportRequests\": [\n    {\n      \"viewId\": \"XXXXXXXXX\",\n      \"dateRanges\": [\n        {\n          \"startDate\": \"2020-01-01\",\n          \"endDate\": \"yesterday\"\n        }\n      ],\n      \"metrics\": [\n        {\n          \"expression\": \"ga:pageViews\u002Fga:sessions\",\n          \"alias\": \"page views sessions ratio\"\n        }\n      ],\n      \"dimensions\": [\n        {\n          \"name\": \"ga:month\"\n        }\n      ]\n    }\n  ]\n}\n",[105,4607,4608,4612,4625,4629,4647,4659,4663,4682,4699,4703,4707,4719,4723,4742,4759,4763,4767,4779,4783,4800,4804,4808,4812,4816],{"__ignoreMap":145},[149,4609,4610],{"class":151,"line":152},[149,4611,156],{"class":155},[149,4613,4614,4616,4619,4621,4623],{"class":151,"line":159},[149,4615,162],{"class":155},[149,4617,4618],{"class":165},"reportRequests",[149,4620,169],{"class":155},[149,4622,172],{"class":155},[149,4624,175],{"class":155},[149,4626,4627],{"class":151,"line":178},[149,4628,181],{"class":155},[149,4630,4631,4633,4635,4637,4639,4641,4643,4645],{"class":151,"line":184},[149,4632,187],{"class":155},[149,4634,445],{"class":190},[149,4636,169],{"class":155},[149,4638,172],{"class":155},[149,4640,198],{"class":155},[149,4642,454],{"class":201},[149,4644,169],{"class":155},[149,4646,207],{"class":155},[149,4648,4649,4651,4653,4655,4657],{"class":151,"line":210},[149,4650,187],{"class":155},[149,4652,166],{"class":190},[149,4654,169],{"class":155},[149,4656,172],{"class":155},[149,4658,175],{"class":155},[149,4660,4661],{"class":151,"line":230},[149,4662,838],{"class":155},[149,4664,4665,4667,4669,4671,4673,4675,4678,4680],{"class":151,"line":236},[149,4666,843],{"class":155},[149,4668,191],{"class":375},[149,4670,169],{"class":155},[149,4672,172],{"class":155},[149,4674,198],{"class":155},[149,4676,4677],{"class":201},"2020-01-01",[149,4679,169],{"class":155},[149,4681,207],{"class":155},[149,4683,4684,4686,4688,4690,4692,4694,4697],{"class":151,"line":242},[149,4685,843],{"class":155},[149,4687,215],{"class":375},[149,4689,169],{"class":155},[149,4691,172],{"class":155},[149,4693,198],{"class":155},[149,4695,4696],{"class":201},"yesterday",[149,4698,227],{"class":155},[149,4700,4701],{"class":151,"line":256},[149,4702,862],{"class":155},[149,4704,4705],{"class":151,"line":261},[149,4706,867],{"class":155},[149,4708,4709,4711,4713,4715,4717],{"class":151,"line":279},[149,4710,187],{"class":155},[149,4712,247],{"class":190},[149,4714,169],{"class":155},[149,4716,172],{"class":155},[149,4718,175],{"class":155},[149,4720,4721],{"class":151,"line":284},[149,4722,838],{"class":155},[149,4724,4725,4727,4729,4731,4733,4735,4738,4740],{"class":151,"line":289},[149,4726,843],{"class":155},[149,4728,111],{"class":375},[149,4730,169],{"class":155},[149,4732,172],{"class":155},[149,4734,198],{"class":155},[149,4736,4737],{"class":201},"ga:pageViews\u002Fga:sessions",[149,4739,169],{"class":155},[149,4741,207],{"class":155},[149,4743,4744,4746,4748,4750,4752,4754,4757],{"class":151,"line":303},[149,4745,843],{"class":155},[149,4747,558],{"class":375},[149,4749,169],{"class":155},[149,4751,172],{"class":155},[149,4753,198],{"class":155},[149,4755,4756],{"class":201},"page views sessions ratio",[149,4758,227],{"class":155},[149,4760,4761],{"class":151,"line":308},[149,4762,862],{"class":155},[149,4764,4765],{"class":151,"line":326},[149,4766,867],{"class":155},[149,4768,4769,4771,4773,4775,4777],{"class":151,"line":331},[149,4770,187],{"class":155},[149,4772,294],{"class":190},[149,4774,169],{"class":155},[149,4776,172],{"class":155},[149,4778,175],{"class":155},[149,4780,4781],{"class":151,"line":336},[149,4782,838],{"class":155},[149,4784,4785,4787,4789,4791,4793,4795,4798],{"class":151,"line":349},[149,4786,843],{"class":155},[149,4788,107],{"class":375},[149,4790,169],{"class":155},[149,4792,172],{"class":155},[149,4794,198],{"class":155},[149,4796,4797],{"class":201},"ga:month",[149,4799,227],{"class":155},[149,4801,4802],{"class":151,"line":354},[149,4803,862],{"class":155},[149,4805,4806],{"class":151,"line":369},[149,4807,910],{"class":155},[149,4809,4810],{"class":151,"line":389},[149,4811,233],{"class":155},[149,4813,4814],{"class":151,"line":395},[149,4815,418],{"class":155},[149,4817,4818],{"class":151,"line":410},[149,4819,424],{"class":155},[81,4821,4823],{"id":4822},"histogram","Histogram",[11,4825,4826,4827,4830,4831,4834],{},"Another feature extends the use of dimensions as it allows a numeric dimension to be converted into groups, so-called buckets, by specified breaks. The breaks work as thresholds separating the values into the buckets. There are always ",[45,4828,4829],{},"n+1"," buckets for ",[45,4832,4833],{},"n"," thresholds - for two break points there will be three buckets with the following structure of names “\u003C[break1]”, “[break1]”, “[break2]+”.",[11,4836,4837],{},"The easiest application of this feature lies in the aggregation of time variables, even though you’ll find further uses based on your specific case. The histogram allows you to construct quarters from months, combine several, even irregular amounts of days or weeks together, or compare several phases within a day. The last case is shown in the following example.",[11,4839,4840,4841,129,4844,4847],{},"The histogram request results in an ",[15,4842,4843],{},"aggregated",[15,4845,4846],{},"table of all selected metrics grouped by the created groups"," (buckets). The output does not change the structure of the data, so you can use the data in further programs and applications without the need to form any additional schema or adjust any data manipulations. You can select multiple metrics to compare the evolution of several values in parallel, as in the following example.",[11,4849,4850],{},"The output from this request can be transformed into a histogram using the buckets to form the columns with the values of metrics as their height. This provides an easy view of the evolution of your data.",[28,4852,4853],{},"\nWhen you want to form a graph using several metrics, you need to be careful if the metrics have diametrically different values, as the graph can be not as informative for the smaller metric.\n",[11,4855,4856],{},[2536,4857],{"alt":145,"src":4858},"\u002Fupload\u002Fga-api-v4-article-users-and-sessions-chart-1.png",[140,4860,4862],{"className":142,"code":4861,"language":144,"meta":145,"style":145},"{\n  \"reportRequests\": [\n    {\n      \"viewId\": \"XXXXXXXXX\",\n      \"dateRanges\": [\n        {\n          \"startDate\": \"2020-01-01\",\n          \"endDate\": \"yesterday\"\n        }\n      ],\n      \"metrics\": [\n        {\n          \"expression\": \"ga:users\"\n        },\n        {\n          \"expression\": \"ga:sessions\"\n        }\n      ],\n      \"dimensions\": [\n        {\n          \"name\": \"ga:month\",\n          \"histogramBuckets\": [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\"]\n        }\n      ],\n      \"orderBys\": [\n        {\n          \"fieldName\": \"ga:month\",\n          \"orderType\": \"HISTOGRAM_BUCKET\",\n          \"sortOrder\": \"ASCENDING\"\n        }\n      ]\n    }\n  ]\n}\n",[105,4863,4864,4868,4880,4884,4902,4914,4918,4936,4952,4956,4960,4972,4976,4992,4996,5000,5016,5020,5024,5036,5040,5058,5123,5127,5131,5143,5147,5165,5185,5202,5206,5210,5214,5218],{"__ignoreMap":145},[149,4865,4866],{"class":151,"line":152},[149,4867,156],{"class":155},[149,4869,4870,4872,4874,4876,4878],{"class":151,"line":159},[149,4871,162],{"class":155},[149,4873,4618],{"class":165},[149,4875,169],{"class":155},[149,4877,172],{"class":155},[149,4879,175],{"class":155},[149,4881,4882],{"class":151,"line":178},[149,4883,181],{"class":155},[149,4885,4886,4888,4890,4892,4894,4896,4898,4900],{"class":151,"line":184},[149,4887,187],{"class":155},[149,4889,445],{"class":190},[149,4891,169],{"class":155},[149,4893,172],{"class":155},[149,4895,198],{"class":155},[149,4897,454],{"class":201},[149,4899,169],{"class":155},[149,4901,207],{"class":155},[149,4903,4904,4906,4908,4910,4912],{"class":151,"line":210},[149,4905,187],{"class":155},[149,4907,166],{"class":190},[149,4909,169],{"class":155},[149,4911,172],{"class":155},[149,4913,175],{"class":155},[149,4915,4916],{"class":151,"line":230},[149,4917,838],{"class":155},[149,4919,4920,4922,4924,4926,4928,4930,4932,4934],{"class":151,"line":236},[149,4921,843],{"class":155},[149,4923,191],{"class":375},[149,4925,169],{"class":155},[149,4927,172],{"class":155},[149,4929,198],{"class":155},[149,4931,4677],{"class":201},[149,4933,169],{"class":155},[149,4935,207],{"class":155},[149,4937,4938,4940,4942,4944,4946,4948,4950],{"class":151,"line":242},[149,4939,843],{"class":155},[149,4941,215],{"class":375},[149,4943,169],{"class":155},[149,4945,172],{"class":155},[149,4947,198],{"class":155},[149,4949,4696],{"class":201},[149,4951,227],{"class":155},[149,4953,4954],{"class":151,"line":256},[149,4955,862],{"class":155},[149,4957,4958],{"class":151,"line":261},[149,4959,867],{"class":155},[149,4961,4962,4964,4966,4968,4970],{"class":151,"line":279},[149,4963,187],{"class":155},[149,4965,247],{"class":190},[149,4967,169],{"class":155},[149,4969,172],{"class":155},[149,4971,175],{"class":155},[149,4973,4974],{"class":151,"line":284},[149,4975,838],{"class":155},[149,4977,4978,4980,4982,4984,4986,4988,4990],{"class":151,"line":289},[149,4979,843],{"class":155},[149,4981,111],{"class":375},[149,4983,169],{"class":155},[149,4985,172],{"class":155},[149,4987,198],{"class":155},[149,4989,666],{"class":201},[149,4991,227],{"class":155},[149,4993,4994],{"class":151,"line":303},[149,4995,3367],{"class":155},[149,4997,4998],{"class":151,"line":308},[149,4999,838],{"class":155},[149,5001,5002,5004,5006,5008,5010,5012,5014],{"class":151,"line":326},[149,5003,843],{"class":155},[149,5005,111],{"class":375},[149,5007,169],{"class":155},[149,5009,172],{"class":155},[149,5011,198],{"class":155},[149,5013,547],{"class":201},[149,5015,227],{"class":155},[149,5017,5018],{"class":151,"line":331},[149,5019,862],{"class":155},[149,5021,5022],{"class":151,"line":336},[149,5023,867],{"class":155},[149,5025,5026,5028,5030,5032,5034],{"class":151,"line":349},[149,5027,187],{"class":155},[149,5029,294],{"class":190},[149,5031,169],{"class":155},[149,5033,172],{"class":155},[149,5035,175],{"class":155},[149,5037,5038],{"class":151,"line":354},[149,5039,838],{"class":155},[149,5041,5042,5044,5046,5048,5050,5052,5054,5056],{"class":151,"line":369},[149,5043,843],{"class":155},[149,5045,107],{"class":375},[149,5047,169],{"class":155},[149,5049,172],{"class":155},[149,5051,198],{"class":155},[149,5053,4797],{"class":201},[149,5055,169],{"class":155},[149,5057,207],{"class":155},[149,5059,5060,5062,5065,5067,5069,5071,5073,5076,5078,5081,5083,5086,5088,5090,5092,5095,5097,5099,5101,5103,5105,5107,5109,5111,5113,5115,5117,5119,5121],{"class":151,"line":389},[149,5061,843],{"class":155},[149,5063,5064],{"class":375},"histogramBuckets",[149,5066,169],{"class":155},[149,5068,172],{"class":155},[149,5070,1240],{"class":155},[149,5072,169],{"class":155},[149,5074,5075],{"class":201},"1",[149,5077,169],{"class":155},[149,5079,5080],{"class":155},",",[149,5082,198],{"class":155},[149,5084,5085],{"class":201},"2",[149,5087,169],{"class":155},[149,5089,5080],{"class":155},[149,5091,198],{"class":155},[149,5093,5094],{"class":201},"3",[149,5096,169],{"class":155},[149,5098,5080],{"class":155},[149,5100,198],{"class":155},[149,5102,4595],{"class":201},[149,5104,169],{"class":155},[149,5106,5080],{"class":155},[149,5108,198],{"class":155},[149,5110,4565],{"class":201},[149,5112,169],{"class":155},[149,5114,5080],{"class":155},[149,5116,198],{"class":155},[149,5118,4580],{"class":201},[149,5120,169],{"class":155},[149,5122,1413],{"class":155},[149,5124,5125],{"class":151,"line":395},[149,5126,862],{"class":155},[149,5128,5129],{"class":151,"line":410},[149,5130,867],{"class":155},[149,5132,5133,5135,5137,5139,5141],{"class":151,"line":415},[149,5134,187],{"class":155},[149,5136,121],{"class":190},[149,5138,169],{"class":155},[149,5140,172],{"class":155},[149,5142,175],{"class":155},[149,5144,5145],{"class":151,"line":421},[149,5146,838],{"class":155},[149,5148,5149,5151,5153,5155,5157,5159,5161,5163],{"class":151,"line":963},[149,5150,843],{"class":155},[149,5152,657],{"class":375},[149,5154,169],{"class":155},[149,5156,172],{"class":155},[149,5158,198],{"class":155},[149,5160,4797],{"class":201},[149,5162,169],{"class":155},[149,5164,207],{"class":155},[149,5166,5167,5169,5172,5174,5176,5178,5181,5183],{"class":151,"line":976},[149,5168,843],{"class":155},[149,5170,5171],{"class":375},"orderType",[149,5173,169],{"class":155},[149,5175,172],{"class":155},[149,5177,198],{"class":155},[149,5179,5180],{"class":201},"HISTOGRAM_BUCKET",[149,5182,169],{"class":155},[149,5184,207],{"class":155},[149,5186,5187,5189,5191,5193,5195,5197,5200],{"class":151,"line":981},[149,5188,843],{"class":155},[149,5190,637],{"class":375},[149,5192,169],{"class":155},[149,5194,172],{"class":155},[149,5196,198],{"class":155},[149,5198,5199],{"class":201},"ASCENDING",[149,5201,227],{"class":155},[149,5203,5204],{"class":151,"line":999},[149,5205,862],{"class":155},[149,5207,5208],{"class":151,"line":1004},[149,5209,910],{"class":155},[149,5211,5212],{"class":151,"line":1009},[149,5213,233],{"class":155},[149,5215,5216],{"class":151,"line":1014},[149,5217,418],{"class":155},[149,5219,5220],{"class":151,"line":1019},[149,5221,424],{"class":155},[81,5223,5225],{"id":5224},"compare-dimensions-with-pivot","Compare dimensions with pivot",[11,5227,5228,5229,129,5232,5235],{},"Pivot tables help to separate the values of metrics more clearly by two selected dimensions. While it is possible to have an output with multiple dimensions even without the pivot feature (in the so-called long format with a row for each combination of dimensions), the pivot table allows a ",[15,5230,5231],{},"better comparison",[15,5233,5234],{},"of the values within both dimensions",". With the pivot table, you can check how the values change when keeping one of the dimensions the same and changing the other by following either the given rows or columns.",[11,5237,5238],{},"The resulting data have a different structure than the output of a simple query because the pivot table forms an additional object in the data rows. Therefore, to incorporate it into further transformations, the schema and the calculations need to be adjusted.",[11,5240,5241],{},"As an example, we provide an overview of sessions and users by 4 hostnames where the count of users is separated into months between months.",[3801,5243,5244],{},[3804,5245,5246,5268],{},[3807,5247,5248],{},[3810,5249,5250,5252,5254,5256,5258,5260,5262,5264,5266],{},[3813,5251,129],{},[3813,5253,129],{},[3813,5255,129],{},[3813,5257,4562],{},[3813,5259,4570],{},[3813,5261,4577],{},[3813,5263,4585],{},[3813,5265,4592],{},[3813,5267,4600],{},[3825,5269,5270,5308,5339,5370,5401,5430],{},[3810,5271,5272,5274,5279,5284,5288,5292,5296,5300,5304],{},[3830,5273,129],{},[3830,5275,5276],{},[15,5277,5278],{},"Users",[3830,5280,5281],{},[15,5282,5283],{},"Sessions",[3830,5285,5286],{},[15,5287,5278],{},[3830,5289,5290],{},[15,5291,5278],{},[3830,5293,5294],{},[15,5295,5278],{},[3830,5297,5298],{},[15,5299,5278],{},[3830,5301,5302],{},[15,5303,5278],{},[3830,5305,5306],{},[15,5307,5278],{},[3810,5309,5310,5315,5318,5321,5324,5327,5330,5333,5336],{},[3830,5311,5312],{},[15,5313,5314],{},"hostname 1",[3830,5316,5317],{},"776 000",[3830,5319,5320],{},"1 940 000",[3830,5322,5323],{},"121 000",[3830,5325,5326],{},"118 000",[3830,5328,5329],{},"135 000",[3830,5331,5332],{},"132 000",[3830,5334,5335],{},"142 000",[3830,5337,5338],{},"128 000",[3810,5340,5341,5346,5349,5352,5355,5358,5361,5364,5367],{},[3830,5342,5343],{},[15,5344,5345],{},"hostname 2",[3830,5347,5348],{},"605 000",[3830,5350,5351],{},"1 512 500",[3830,5353,5354],{},"89 000",[3830,5356,5357],{},"91 000",[3830,5359,5360],{},"102 000",[3830,5362,5363],{},"104 000",[3830,5365,5366],{},"112 000",[3830,5368,5369],{},"107 000",[3810,5371,5372,5377,5380,5383,5386,5389,5392,5395,5398],{},[3830,5373,5374],{},[15,5375,5376],{},"hostname 3",[3830,5378,5379],{},"11 500",[3830,5381,5382],{},"28 750",[3830,5384,5385],{},"1 200",[3830,5387,5388],{},"1 800",[3830,5390,5391],{},"1 000",[3830,5393,5394],{},"1 400",[3830,5396,5397],{},"2 100",[3830,5399,5400],{},"4 000",[3810,5402,5403,5408,5411,5414,5417,5420,5422,5425,5428],{},[3830,5404,5405],{},[15,5406,5407],{},"hostname 4",[3830,5409,5410],{},"8 500",[3830,5412,5413],{},"21 250",[3830,5415,5416],{},"1 500",[3830,5418,5419],{},"900",[3830,5421,5385],{},[3830,5423,5424],{},"1 100",[3830,5426,5427],{},"1 700",[3830,5429,5397],{},[3810,5431,5432,5437,5440,5443,5446,5449,5452,5455,5458],{},[3830,5433,5434],{},[15,5435,5436],{},"TOTALS",[3830,5438,5439],{},"1 401 000",[3830,5441,5442],{},"3 502 500",[3830,5444,5445],{},"212 700",[3830,5447,5448],{},"211 700",[3830,5450,5451],{},"239 200",[3830,5453,5454],{},"238 500",[3830,5456,5457],{},"257 800",[3830,5459,5460],{},"241 100",[140,5462,5464],{"className":142,"code":5463,"language":144,"meta":145,"style":145},"{\n  \"reportRequests\": [\n    {\n      \"viewId\": \"XXXXXXXXX\",\n      \"dateRanges\": [\n        {\n          \"startDate\": \"2020-01-01\",\n          \"endDate\": \"yesterday\"\n        }\n      ],\n      \"metrics\": [\n        {\n          \"expression\": \"ga:users\"\n        },\n        {\n          \"expression\": \"ga:sessions\"\n        }\n      ],\n      \"dimensions\": [\n        {\n          \"name\": \"ga:hostname\"\n        }\n      ],\n      \"pivots\": [\n        {\n          \"dimensions\": [\n            {\n              \"name\": \"ga:month\"\n            }\n          ],\n          \"metrics\": [\n            {\n              \"expression\": \"ga:users\"\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}\n",[105,5465,5466,5470,5482,5486,5504,5516,5520,5538,5554,5558,5562,5574,5578,5594,5598,5602,5618,5622,5626,5638,5642,5659,5663,5667,5679,5683,5695,5699,5715,5719,5724,5736,5740,5756,5760,5765,5769,5773,5777,5781],{"__ignoreMap":145},[149,5467,5468],{"class":151,"line":152},[149,5469,156],{"class":155},[149,5471,5472,5474,5476,5478,5480],{"class":151,"line":159},[149,5473,162],{"class":155},[149,5475,4618],{"class":165},[149,5477,169],{"class":155},[149,5479,172],{"class":155},[149,5481,175],{"class":155},[149,5483,5484],{"class":151,"line":178},[149,5485,181],{"class":155},[149,5487,5488,5490,5492,5494,5496,5498,5500,5502],{"class":151,"line":184},[149,5489,187],{"class":155},[149,5491,445],{"class":190},[149,5493,169],{"class":155},[149,5495,172],{"class":155},[149,5497,198],{"class":155},[149,5499,454],{"class":201},[149,5501,169],{"class":155},[149,5503,207],{"class":155},[149,5505,5506,5508,5510,5512,5514],{"class":151,"line":210},[149,5507,187],{"class":155},[149,5509,166],{"class":190},[149,5511,169],{"class":155},[149,5513,172],{"class":155},[149,5515,175],{"class":155},[149,5517,5518],{"class":151,"line":230},[149,5519,838],{"class":155},[149,5521,5522,5524,5526,5528,5530,5532,5534,5536],{"class":151,"line":236},[149,5523,843],{"class":155},[149,5525,191],{"class":375},[149,5527,169],{"class":155},[149,5529,172],{"class":155},[149,5531,198],{"class":155},[149,5533,4677],{"class":201},[149,5535,169],{"class":155},[149,5537,207],{"class":155},[149,5539,5540,5542,5544,5546,5548,5550,5552],{"class":151,"line":242},[149,5541,843],{"class":155},[149,5543,215],{"class":375},[149,5545,169],{"class":155},[149,5547,172],{"class":155},[149,5549,198],{"class":155},[149,5551,4696],{"class":201},[149,5553,227],{"class":155},[149,5555,5556],{"class":151,"line":256},[149,5557,862],{"class":155},[149,5559,5560],{"class":151,"line":261},[149,5561,867],{"class":155},[149,5563,5564,5566,5568,5570,5572],{"class":151,"line":279},[149,5565,187],{"class":155},[149,5567,247],{"class":190},[149,5569,169],{"class":155},[149,5571,172],{"class":155},[149,5573,175],{"class":155},[149,5575,5576],{"class":151,"line":284},[149,5577,838],{"class":155},[149,5579,5580,5582,5584,5586,5588,5590,5592],{"class":151,"line":289},[149,5581,843],{"class":155},[149,5583,111],{"class":375},[149,5585,169],{"class":155},[149,5587,172],{"class":155},[149,5589,198],{"class":155},[149,5591,666],{"class":201},[149,5593,227],{"class":155},[149,5595,5596],{"class":151,"line":303},[149,5597,3367],{"class":155},[149,5599,5600],{"class":151,"line":308},[149,5601,838],{"class":155},[149,5603,5604,5606,5608,5610,5612,5614,5616],{"class":151,"line":326},[149,5605,843],{"class":155},[149,5607,111],{"class":375},[149,5609,169],{"class":155},[149,5611,172],{"class":155},[149,5613,198],{"class":155},[149,5615,547],{"class":201},[149,5617,227],{"class":155},[149,5619,5620],{"class":151,"line":331},[149,5621,862],{"class":155},[149,5623,5624],{"class":151,"line":336},[149,5625,867],{"class":155},[149,5627,5628,5630,5632,5634,5636],{"class":151,"line":349},[149,5629,187],{"class":155},[149,5631,294],{"class":190},[149,5633,169],{"class":155},[149,5635,172],{"class":155},[149,5637,175],{"class":155},[149,5639,5640],{"class":151,"line":354},[149,5641,838],{"class":155},[149,5643,5644,5646,5648,5650,5652,5654,5657],{"class":151,"line":369},[149,5645,843],{"class":155},[149,5647,107],{"class":375},[149,5649,169],{"class":155},[149,5651,172],{"class":155},[149,5653,198],{"class":155},[149,5655,5656],{"class":201},"ga:hostname",[149,5658,227],{"class":155},[149,5660,5661],{"class":151,"line":389},[149,5662,862],{"class":155},[149,5664,5665],{"class":151,"line":395},[149,5666,867],{"class":155},[149,5668,5669,5671,5673,5675,5677],{"class":151,"line":410},[149,5670,187],{"class":155},[149,5672,3521],{"class":190},[149,5674,169],{"class":155},[149,5676,172],{"class":155},[149,5678,175],{"class":155},[149,5680,5681],{"class":151,"line":415},[149,5682,838],{"class":155},[149,5684,5685,5687,5689,5691,5693],{"class":151,"line":421},[149,5686,843],{"class":155},[149,5688,294],{"class":375},[149,5690,169],{"class":155},[149,5692,172],{"class":155},[149,5694,175],{"class":155},[149,5696,5697],{"class":151,"line":963},[149,5698,2565],{"class":155},[149,5700,5701,5703,5705,5707,5709,5711,5713],{"class":151,"line":976},[149,5702,2089],{"class":155},[149,5704,107],{"class":1285},[149,5706,169],{"class":155},[149,5708,172],{"class":155},[149,5710,198],{"class":155},[149,5712,4797],{"class":201},[149,5714,227],{"class":155},[149,5716,5717],{"class":151,"line":981},[149,5718,1561],{"class":155},[149,5720,5721],{"class":151,"line":999},[149,5722,5723],{"class":155},"          ],\n",[149,5725,5726,5728,5730,5732,5734],{"class":151,"line":1004},[149,5727,843],{"class":155},[149,5729,247],{"class":375},[149,5731,169],{"class":155},[149,5733,172],{"class":155},[149,5735,175],{"class":155},[149,5737,5738],{"class":151,"line":1009},[149,5739,2565],{"class":155},[149,5741,5742,5744,5746,5748,5750,5752,5754],{"class":151,"line":1014},[149,5743,2089],{"class":155},[149,5745,111],{"class":1285},[149,5747,169],{"class":155},[149,5749,172],{"class":155},[149,5751,198],{"class":155},[149,5753,666],{"class":201},[149,5755,227],{"class":155},[149,5757,5758],{"class":151,"line":1019},[149,5759,1561],{"class":155},[149,5761,5762],{"class":151,"line":1032},[149,5763,5764],{"class":155},"          ]\n",[149,5766,5767],{"class":151,"line":1037},[149,5768,862],{"class":155},[149,5770,5771],{"class":151,"line":1055},[149,5772,910],{"class":155},[149,5774,5775],{"class":151,"line":1060},[149,5776,233],{"class":155},[149,5778,5779],{"class":151,"line":1065},[149,5780,418],{"class":155},[149,5782,5783],{"class":151,"line":1078},[149,5784,424],{"class":155},[81,5786,5788],{"id":5787},"cohorts-to-track-behavioral-time-evolution","Cohorts to track behavioral time evolution",[11,5790,5791,5792,5795,5796,5799,5800,5803,5804],{},"A fourth specific feature of the GA v4 API requests is the introduction of the cohorts and ",[15,5793,5794],{},"lifetime value reports",". While at the moment it only supports the acquisition date (date of their first visit) to separate the cohorts, it already provides meaningful insight by showing ",[15,5797,5798],{},"how users"," from the same day, week, or month ",[15,5801,5802],{},"performed in a selected aspect in comparison to other time cohorts"," during the selected period. You can learn about the behavior in terms of users, sessions, page views, goal completions, and similar cohort-specific metrics. The earlier cohorts are observed for longer, providing the data for more periods. In particular, when observing 3 monthly cohorts for 4 months, there are 4 periods of data for the earliest cohort and 2 periods for the latest. This allows you to compare how all the cohorts are behaving in the month of acquisition as well as in the month after the acquisition. Moreover, you can ",[15,5805,5806],{},"analyze how one cohort evolves over several months.",[3801,5808,5809],{},[3804,5810,5811,5830],{},[3807,5812,5813],{},[3810,5814,5815,5818,5821,5824,5827],{},[3813,5816,5817],{},"Cohort",[3813,5819,5820],{},"Month 0",[3813,5822,5823],{},"Month 1",[3813,5825,5826],{},"Month 2",[3813,5828,5829],{},"Month 3",[3825,5831,5832,5849,5866],{},[3810,5833,5834,5837,5840,5843,5846],{},[3830,5835,5836],{},"2020-03",[3830,5838,5839],{},"165 000",[3830,5841,5842],{},"25 000",[3830,5844,5845],{},"8 400",[3830,5847,5848],{},"4 200",[3810,5850,5851,5854,5857,5860,5863],{},[3830,5852,5853],{},"2020-04",[3830,5855,5856],{},"174 000",[3830,5858,5859],{},"28 000",[3830,5861,5862],{},"9 200",[3830,5864,5865],{}," -",[3810,5867,5868,5871,5874,5877,5879],{},[3830,5869,5870],{},"2020-05",[3830,5872,5873],{},"189 000",[3830,5875,5876],{},"32 000",[3830,5878,5865],{},[3830,5880,5865],{},[140,5882,5884],{"className":142,"code":5883,"language":144,"meta":145,"style":145},"{\n  \"reportRequests\": [\n    {\n      \"viewId\": \"XXXXXXXXX\",\n      \"includeEmptyRows\": true,\n      \"metrics\": [\n        {\n          \"expression\": \"ga:cohortActiveUsers\"\n        }\n      ],\n      \"dimensions\": [\n        {\n          \"name\": \"ga:cohort\"\n        },\n        {\n          \"name\": \"ga:cohortNthMonth\"\n        }\n      ],\n      \"orderBys\": [\n        {\n          \"fieldName\": \"ga:cohort\"\n        }\n      ],\n      \"cohortGroup\": {\n        \"cohorts\": [\n          {\n            \"type\": \"FIRST_VISIT_DATE\",\n            \"name\": \"2020-05-01 to 2020-05-31\",\n            \"dateRange\": {\n              \"startDate\": \"2020-05-01\",\n              \"endDate\": \"2020-05-31\"\n            }\n          },\n          {\n            \"type\": \"FIRST_VISIT_DATE\",\n            \"name\": \"2020-04-01 to 2020-04-30\",\n            \"dateRange\": {\n              \"startDate\": \"2020-04-01\",\n              \"endDate\": \"2020-04-30\"\n            }\n          },\n          {\n            \"type\": \"FIRST_VISIT_DATE\",\n            \"name\": \"2020-03-01 to 2020-03-31\",\n            \"dateRange\": {\n              \"startDate\": \"2020-03-01\",\n              \"endDate\": \"2020-03-31\"\n            }\n          }\n        ]\n      }\n    }\n  ]\n}\n",[105,5885,5886,5890,5902,5906,5924,5938,5950,5954,5971,5975,5979,5991,5995,6012,6016,6020,6037,6041,6045,6057,6061,6077,6081,6085,6098,6110,6114,6133,6152,6164,6183,6200,6204,6209,6213,6231,6250,6262,6281,6298,6302,6306,6310,6328,6347,6359,6378,6395,6399,6403,6407,6411,6415,6419],{"__ignoreMap":145},[149,5887,5888],{"class":151,"line":152},[149,5889,156],{"class":155},[149,5891,5892,5894,5896,5898,5900],{"class":151,"line":159},[149,5893,162],{"class":155},[149,5895,4618],{"class":165},[149,5897,169],{"class":155},[149,5899,172],{"class":155},[149,5901,175],{"class":155},[149,5903,5904],{"class":151,"line":178},[149,5905,181],{"class":155},[149,5907,5908,5910,5912,5914,5916,5918,5920,5922],{"class":151,"line":184},[149,5909,187],{"class":155},[149,5911,445],{"class":190},[149,5913,169],{"class":155},[149,5915,172],{"class":155},[149,5917,198],{"class":155},[149,5919,454],{"class":201},[149,5921,169],{"class":155},[149,5923,207],{"class":155},[149,5925,5926,5928,5931,5933,5935],{"class":151,"line":210},[149,5927,187],{"class":155},[149,5929,5930],{"class":190},"includeEmptyRows",[149,5932,169],{"class":155},[149,5934,172],{"class":155},[149,5936,5937],{"class":155}," true,\n",[149,5939,5940,5942,5944,5946,5948],{"class":151,"line":230},[149,5941,187],{"class":155},[149,5943,247],{"class":190},[149,5945,169],{"class":155},[149,5947,172],{"class":155},[149,5949,175],{"class":155},[149,5951,5952],{"class":151,"line":236},[149,5953,838],{"class":155},[149,5955,5956,5958,5960,5962,5964,5966,5969],{"class":151,"line":242},[149,5957,843],{"class":155},[149,5959,111],{"class":375},[149,5961,169],{"class":155},[149,5963,172],{"class":155},[149,5965,198],{"class":155},[149,5967,5968],{"class":201},"ga:cohortActiveUsers",[149,5970,227],{"class":155},[149,5972,5973],{"class":151,"line":256},[149,5974,862],{"class":155},[149,5976,5977],{"class":151,"line":261},[149,5978,867],{"class":155},[149,5980,5981,5983,5985,5987,5989],{"class":151,"line":279},[149,5982,187],{"class":155},[149,5984,294],{"class":190},[149,5986,169],{"class":155},[149,5988,172],{"class":155},[149,5990,175],{"class":155},[149,5992,5993],{"class":151,"line":284},[149,5994,838],{"class":155},[149,5996,5997,5999,6001,6003,6005,6007,6010],{"class":151,"line":289},[149,5998,843],{"class":155},[149,6000,107],{"class":375},[149,6002,169],{"class":155},[149,6004,172],{"class":155},[149,6006,198],{"class":155},[149,6008,6009],{"class":201},"ga:cohort",[149,6011,227],{"class":155},[149,6013,6014],{"class":151,"line":303},[149,6015,3367],{"class":155},[149,6017,6018],{"class":151,"line":308},[149,6019,838],{"class":155},[149,6021,6022,6024,6026,6028,6030,6032,6035],{"class":151,"line":326},[149,6023,843],{"class":155},[149,6025,107],{"class":375},[149,6027,169],{"class":155},[149,6029,172],{"class":155},[149,6031,198],{"class":155},[149,6033,6034],{"class":201},"ga:cohortNthMonth",[149,6036,227],{"class":155},[149,6038,6039],{"class":151,"line":331},[149,6040,862],{"class":155},[149,6042,6043],{"class":151,"line":336},[149,6044,867],{"class":155},[149,6046,6047,6049,6051,6053,6055],{"class":151,"line":349},[149,6048,187],{"class":155},[149,6050,121],{"class":190},[149,6052,169],{"class":155},[149,6054,172],{"class":155},[149,6056,175],{"class":155},[149,6058,6059],{"class":151,"line":354},[149,6060,838],{"class":155},[149,6062,6063,6065,6067,6069,6071,6073,6075],{"class":151,"line":369},[149,6064,843],{"class":155},[149,6066,657],{"class":375},[149,6068,169],{"class":155},[149,6070,172],{"class":155},[149,6072,198],{"class":155},[149,6074,6009],{"class":201},[149,6076,227],{"class":155},[149,6078,6079],{"class":151,"line":389},[149,6080,862],{"class":155},[149,6082,6083],{"class":151,"line":395},[149,6084,867],{"class":155},[149,6086,6087,6089,6092,6094,6096],{"class":151,"line":410},[149,6088,187],{"class":155},[149,6090,6091],{"class":190},"cohortGroup",[149,6093,169],{"class":155},[149,6095,172],{"class":155},[149,6097,366],{"class":155},[149,6099,6100,6102,6104,6106,6108],{"class":151,"line":415},[149,6101,372],{"class":155},[149,6103,2510],{"class":375},[149,6105,169],{"class":155},[149,6107,172],{"class":155},[149,6109,175],{"class":155},[149,6111,6112],{"class":151,"line":421},[149,6113,2072],{"class":155},[149,6115,6116,6118,6120,6122,6124,6126,6129,6131],{"class":151,"line":963},[149,6117,1267],{"class":155},[149,6119,784],{"class":1285},[149,6121,169],{"class":155},[149,6123,172],{"class":155},[149,6125,198],{"class":155},[149,6127,6128],{"class":201},"FIRST_VISIT_DATE",[149,6130,169],{"class":155},[149,6132,207],{"class":155},[149,6134,6135,6137,6139,6141,6143,6145,6148,6150],{"class":151,"line":976},[149,6136,1267],{"class":155},[149,6138,107],{"class":1285},[149,6140,169],{"class":155},[149,6142,172],{"class":155},[149,6144,198],{"class":155},[149,6146,6147],{"class":201},"2020-05-01 to 2020-05-31",[149,6149,169],{"class":155},[149,6151,207],{"class":155},[149,6153,6154,6156,6158,6160,6162],{"class":151,"line":981},[149,6155,1267],{"class":155},[149,6157,2749],{"class":1285},[149,6159,169],{"class":155},[149,6161,172],{"class":155},[149,6163,366],{"class":155},[149,6165,6166,6168,6170,6172,6174,6176,6179,6181],{"class":151,"line":999},[149,6167,2089],{"class":155},[149,6169,191],{"class":2092},[149,6171,169],{"class":155},[149,6173,172],{"class":155},[149,6175,198],{"class":155},[149,6177,6178],{"class":201},"2020-05-01",[149,6180,169],{"class":155},[149,6182,207],{"class":155},[149,6184,6185,6187,6189,6191,6193,6195,6198],{"class":151,"line":1004},[149,6186,2089],{"class":155},[149,6188,215],{"class":2092},[149,6190,169],{"class":155},[149,6192,172],{"class":155},[149,6194,198],{"class":155},[149,6196,6197],{"class":201},"2020-05-31",[149,6199,227],{"class":155},[149,6201,6202],{"class":151,"line":1009},[149,6203,1561],{"class":155},[149,6205,6206],{"class":151,"line":1014},[149,6207,6208],{"class":155},"          },\n",[149,6210,6211],{"class":151,"line":1019},[149,6212,2072],{"class":155},[149,6214,6215,6217,6219,6221,6223,6225,6227,6229],{"class":151,"line":1032},[149,6216,1267],{"class":155},[149,6218,784],{"class":1285},[149,6220,169],{"class":155},[149,6222,172],{"class":155},[149,6224,198],{"class":155},[149,6226,6128],{"class":201},[149,6228,169],{"class":155},[149,6230,207],{"class":155},[149,6232,6233,6235,6237,6239,6241,6243,6246,6248],{"class":151,"line":1037},[149,6234,1267],{"class":155},[149,6236,107],{"class":1285},[149,6238,169],{"class":155},[149,6240,172],{"class":155},[149,6242,198],{"class":155},[149,6244,6245],{"class":201},"2020-04-01 to 2020-04-30",[149,6247,169],{"class":155},[149,6249,207],{"class":155},[149,6251,6252,6254,6256,6258,6260],{"class":151,"line":1055},[149,6253,1267],{"class":155},[149,6255,2749],{"class":1285},[149,6257,169],{"class":155},[149,6259,172],{"class":155},[149,6261,366],{"class":155},[149,6263,6264,6266,6268,6270,6272,6274,6277,6279],{"class":151,"line":1060},[149,6265,2089],{"class":155},[149,6267,191],{"class":2092},[149,6269,169],{"class":155},[149,6271,172],{"class":155},[149,6273,198],{"class":155},[149,6275,6276],{"class":201},"2020-04-01",[149,6278,169],{"class":155},[149,6280,207],{"class":155},[149,6282,6283,6285,6287,6289,6291,6293,6296],{"class":151,"line":1065},[149,6284,2089],{"class":155},[149,6286,215],{"class":2092},[149,6288,169],{"class":155},[149,6290,172],{"class":155},[149,6292,198],{"class":155},[149,6294,6295],{"class":201},"2020-04-30",[149,6297,227],{"class":155},[149,6299,6300],{"class":151,"line":1078},[149,6301,1561],{"class":155},[149,6303,6304],{"class":151,"line":1083},[149,6305,6208],{"class":155},[149,6307,6308],{"class":151,"line":1101},[149,6309,2072],{"class":155},[149,6311,6312,6314,6316,6318,6320,6322,6324,6326],{"class":151,"line":1106},[149,6313,1267],{"class":155},[149,6315,784],{"class":1285},[149,6317,169],{"class":155},[149,6319,172],{"class":155},[149,6321,198],{"class":155},[149,6323,6128],{"class":201},[149,6325,169],{"class":155},[149,6327,207],{"class":155},[149,6329,6330,6332,6334,6336,6338,6340,6343,6345],{"class":151,"line":1111},[149,6331,1267],{"class":155},[149,6333,107],{"class":1285},[149,6335,169],{"class":155},[149,6337,172],{"class":155},[149,6339,198],{"class":155},[149,6341,6342],{"class":201},"2020-03-01 to 2020-03-31",[149,6344,169],{"class":155},[149,6346,207],{"class":155},[149,6348,6349,6351,6353,6355,6357],{"class":151,"line":1116},[149,6350,1267],{"class":155},[149,6352,2749],{"class":1285},[149,6354,169],{"class":155},[149,6356,172],{"class":155},[149,6358,366],{"class":155},[149,6360,6361,6363,6365,6367,6369,6371,6374,6376],{"class":151,"line":1121},[149,6362,2089],{"class":155},[149,6364,191],{"class":2092},[149,6366,169],{"class":155},[149,6368,172],{"class":155},[149,6370,198],{"class":155},[149,6372,6373],{"class":201},"2020-03-01",[149,6375,169],{"class":155},[149,6377,207],{"class":155},[149,6379,6380,6382,6384,6386,6388,6390,6393],{"class":151,"line":1136},[149,6381,2089],{"class":155},[149,6383,215],{"class":2092},[149,6385,169],{"class":155},[149,6387,172],{"class":155},[149,6389,198],{"class":155},[149,6391,6392],{"class":201},"2020-03-31",[149,6394,227],{"class":155},[149,6396,6397],{"class":151,"line":1150},[149,6398,1561],{"class":155},[149,6400,6401],{"class":151,"line":1155},[149,6402,2460],{"class":155},[149,6404,6405],{"class":151,"line":1172},[149,6406,1706],{"class":155},[149,6408,6409],{"class":151,"line":1177},[149,6410,2469],{"class":155},[149,6412,6413],{"class":151,"line":1182},[149,6414,233],{"class":155},[149,6416,6417],{"class":151,"line":1197},[149,6418,418],{"class":155},[149,6420,6422],{"class":151,"line":6421},54,[149,6423,424],{"class":155},[64,6425,6427],{"id":6426},"further-additions","Further additions",[11,6429,6430,6431,6434],{},"Among other benefits of the new API v4 belongs the possibility to use ",[15,6432,6433],{},"multiple date ranges",". This simplifies the procedure to compare values in a short time period to some long-term trend which provides you information about how you are performing in a shorter period.",[11,6436,6437,6438,6441],{},"Furthermore, ",[15,6439,6440],{},"multiple segments"," can be included in a single request. Segments can be used to divide data either to pre-constructed groups using segment ID, e.g. new users or to custom specified groups created using segment filters on dimensions. When multiple segments can be included, you can compare groups of observations without the need to construct multiple queries and combine the resulting data. It can be beneficial for example in comparisons of new vs. returning users or in comparisons of users from different browsers.",[64,6443,6445],{"id":6444},"conclusion","Conclusion",[11,6447,6448],{},"To summarise, the new API v4 enriches the features of Google Analytics API and provides you with more ways to optimize the manipulation and display of data. A clearer view of your data helps you reach more informed solutions and detect potential problems sooner. The testing of the new version revealed new options on how to use the reporting and turn it into a business advantage.",[11,6450,6451,6452,6454,6455,6460],{},"Our tool for web analytics validation – ",[15,6453,57],{}," has the new features implemented. Check out ",[32,6456,6459],{"href":6457,"rel":6458},"https:\u002F\u002Fwaaila.com",[36],"the official website"," for more info.",[4218,6462,6463],{"link":4220,"button":4221},"\nNot sure how to properly use the new features to your advantage? We can help you set it up or create the newest reports for you. Get in touch and find out more.\n",[4224,6465,6466],{},"html pre.shiki code .sAklC, html code.shiki .sAklC{--shiki-default:#89DDFF}html pre.shiki code .sJ14y, html code.shiki .sJ14y{--shiki-default:#C792EA}html pre.shiki code .s5Dmg, html code.shiki .s5Dmg{--shiki-default:#FFCB6B}html pre.shiki code .sfyAc, html code.shiki .sfyAc{--shiki-default:#C3E88D}html pre.shiki code .sx098, html code.shiki .sx098{--shiki-default:#F78C6C}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .s-wAU, html code.shiki .s-wAU{--shiki-default:#F07178}html pre.shiki code .s9WhI, html code.shiki .s9WhI{--shiki-default:#916B53}",{"title":145,"searchDepth":159,"depth":159,"links":6468},[6469,6475,6476],{"id":4502,"depth":159,"text":4503,"children":6470},[6471,6472,6473,6474],{"id":4533,"depth":178,"text":4534},{"id":4822,"depth":178,"text":4823},{"id":5224,"depth":178,"text":5225},{"id":5787,"depth":178,"text":5788},{"id":6426,"depth":159,"text":6427},{"id":6444,"depth":159,"text":6445},"\u002Fupload\u002Fgoogle-analytics-reporting-api-v4-article-cover.webp",{},"Check out the most complex review of the UA API v4 and what new features it can offer.","\u002Fen\u002Fblog\u002Fnotes-on-new-features-of-google-analytics-reporting-api-v4","2020-07-29T12:00:00.000+00:00",8.185,"9 min read",{"title":4463,"description":145},"en\u002Fblog\u002Fnotes-on-new-features-of-google-analytics-reporting-api-v4","PISPgM4Q8NAU9tz8tY_Bc_ccI8FSTS44J6ldWv_GsPk",1789131822705]