[{"data":1,"prerenderedAt":5470},["ShallowReactive",2],{"blog-en-how-to-optimize-utm-for-uniform-campaign-typology":3,"related-en-how-to-optimize-utm-for-uniform-campaign-typology":1016},{"id":4,"title":5,"author":6,"body":7,"category":994,"description":35,"extension":995,"image":996,"isToc":997,"langAlt":6,"meta":998,"metaDescription":6,"navigation":1003,"path":1004,"published":1003,"publishedAt":1005,"readingTimeMinutes":1006,"readingTimeText":1007,"relatedArticles":1008,"seo":1011,"stem":1012,"teaser":1013,"updatedAtCustom":1014,"__hash__":1015},"blog_en\u002Fen\u002Fblog\u002Fhow-to-optimize-utm-for-uniform-campaign-typology.md","How to optimize UTM for uniform campaign typology & tagging",null,{"type":8,"value":9,"toc":974},"minimark",[10,15,19,27,30,37,41,44,47,50,66,70,73,96,101,109,119,126,137,150,154,168,171,175,181,195,199,203,210,227,233,236,241,269,274,294,298,305,310,332,337,374,378,395,399,406,410,413,444,448,468,472,478,498,502,513,518,536,542,553,557,560,580,583,586,612,616,623,635,647,651,661,668,675,678,722,727,822,826,829,836,840,843,848,851,857,867,871,883,894,897,945,955,959,965,968],[11,12,14],"h2",{"id":13},"introduction","Introduction",[16,17,18],"p",{},"Over years we spent countless hours optimizing online campaigns to make them truly effective. To be able to do so we required a much richer set of campaign parameters available for analyses. One solution how to pass such information for further processing is the traditional UTM parameters. In cooperation with major performance and media agencies and several PPC specialists, we were looking for data entities that could have an impact on performance. Now, our meta-model covers over 60 different entities with hundreds of dimensions. For basic performance tuning you do not need all of them, the maximum, we think is practical, covers roughly 40 dimensions. As there are only five UTM parameters we had to develop a technique to squeeze more information into what is available (Google Analytics 4 has only three parameters) to satisfy our needs. This guide is our approach to how to address the limitation and how to assure consistency and unification of campaign tagging.",[16,20,21,22,26],{},"There are two options how to address this problem, ",[23,24,25],"strong",{},"either you combine more parameters into each UTM parameter, or you generate a unique id"," for each dimension combination and keep its metadata in an external system. The external metadata repository is not a simple solution as it requires complex data integration and is thus not suitable for the majority of online spenders. This guide is developed for those using Google Analytics as their primary web analytics tool and other tools besides Google Ads (this can be natively linked to GA and you do not need UTM).",[16,28,29],{},"Combining more dimensions about the campaign in its name UTM parameter can provide you with insight into how targeting, message type, location, etc. impact your performance. You can use these dimensions to filter or compare results between campaigns. In practice, this means that you can easily compare campaign performance when targeting new versus existing customers. Differences between search and retargeting campaigns or when tagging is unified, so you can easily test and evaluate the performance of your channel mix.",[16,31,32],{},[33,34],"img",{"alt":35,"src":36},"","\u002Fupload\u002Fcampaign_tagging_utm.webp",[11,38,40],{"id":39},"how-can-the-typology-of-online-campaigns-help-you","How can the typology of online campaigns help you?",[16,42,43],{},"Tagged campaigns bear special information that can tell you, from where your visitors are coming to your site or which of your campaigns are delivering the best results. With web analytics tools like Google Analytics, you can use information from UTM parameters as dimensions to analyze such detail. If you want to identify how many visitors came to your site from a specific Facebook or Twitter post, you must include these UTM tags in these links as well.",[16,45,46],{},"By tagging individual campaigns, you can distinguish how many people came from specific posts or a specific banner. You can also specify UTM parameters within e-mailing campaigns, cost-per-click (CPC) campaigns, or on your blog. There are many options.",[16,48,49],{},"This article will help you unify the configuration of each campaign URL and parameter so that you can simply:",[51,52,53,60],"ul",{},[54,55,56,59],"li",{},[23,57,58],{},"Universally filter data"," in Google Analytics according to various criteria and get maximum insight into the success of individual campaigns and traffic on your site.",[54,61,62,65],{},[23,63,64],{},"Link costs and revenues"," from individual campaigns. So, you will see not only how each campaign performed, but also how much money it brought, i.e. ROI.",[11,67,69],{"id":68},"lets-start-with-the-general-principles","Let's start with the general principles!",[16,71,72],{},"Consider these rules below as our recommendation, they are based on our experience and years of practice. If you stick to this guideline, it will minimize the number of errors while tagging campaigns, help you to be more effective in analyzing a large campaign portfolio, and will yield deeper insight. Simply it will allow you to make better decisions.",[74,75,76,77,83,84,89,90,95],"note",{},"\nThe \"text\" written in { } brackets everywhere in this document indicates that it is a \"text\" that must be replaced with a \"specific expression\" when used in practical terms. For example, \n",[23,78,79],{},[80,81,82],"code",{},"p_ {product category}","\n refers to a campaign that will have its own name for each product category, which you add yourself based on the type of campaign being prepared, e.g. \n",[23,85,86],{},[80,87,88],{},"p_shoes","\n or \n",[23,91,92],{},[80,93,94],{},"p_glasses","\n.\n",[97,98,100],"h3",{"id":99},"use-delimiters-correctly","Use delimiters correctly",[102,103,105,106],"h4",{"id":104},"underscore-_","Underscore ",[80,107,108],{},"_",[16,110,111,114,115,118],{},[23,112,113],{},"Do not use spaces!"," If you have already used them, replace them with an underscore. For instance, rename the campaign called \"summer sale\" to",[80,116,117],{},"summer_sale",".",[102,120,122,123],{"id":121},"tilde","Tilde ",[80,124,125],{},"~",[16,127,128,129,132,133,136],{},"The wavy line is reserved as a ",[23,130,131],{},"component separator,"," from which the given UTM parameter is composed. Therefore, if you want to separate the campaign name from the report name in the UTM parameter, you can do so as follows: ",[80,134,135],{},"brand~scott",". It indicates the \"brand\" campaign and a group (adGroup, report) named \"scott\". Or, if you buy ads via an RTB platform, you can identify the RTB platform type through the source parameter.",[138,139,140,143,146,149],"example",{},[23,141,142],{},"Example",[144,145],"br",{},[80,147,148],{},"ihned.cz~adf","\n, where “ihned.cz” is the website on which the ad is displayed and ”adf” is the name of the platform (Adform).\n",[97,151,153],{"id":152},"use-lowercase-letters-without-accents","Use lowercase letters without accents",[16,155,156,157,160,161,164,165,118],{},"Google Analytics distinguishes between uppercase and lowercase letters. The campaign name ",[80,158,159],{},"summer sale"," is not the same as the ",[80,162,163],{},"Summer_sale",". Google Analytics evaluates such tags as two different campaigns. Therefore, we recommend ",[23,166,167],{},"using lowercase for campaign names",[16,169,170],{},"While it is possible to insert accented characters into UTM parameters, we do not recommend you to do so. In fact, when copying, importing, etc., the sign may be lost or misinterpreted if the encoding is set incorrectly.",[97,172,174],{"id":173},"unify-the-names-of-the-campaigns-and-values-sent-in-utm-parameters","Unify the names of the campaigns and values sent in UTM parameters",[16,176,177,178],{},"UTM parameters serve as the keys to connect Google Analytics and marketing or advertising platforms (Sklik, AdWords, etc.). If the platform can't export the configured UTM parameters (and this is often the case), or if the UTM parameters don't match the campaign name, then we can't link data from these platforms. Therefore, you ought to assign the same names to campaigns, adGroups, and other parameters that you also use in  UTM parameters. ",[23,179,180],{},"The same campaign should be named the same on different platforms.",[138,182,183,185,187,188,191,192,95],{},[23,184,142],{},[144,186],{},"\n\n\nIf the campaign management system (like Sklik) allows you to use auto-tagging via UTM parameters, then you can, for example, create \n",[80,189,190],{},"utm_campaign","\n as \n",[80,193,194],{},"{campaign}~{adgroup}",[11,196,198],{"id":197},"utm-parameters","UTM parameters",[97,200,202],{"id":201},"source-utm_source","Source (utm_source)",[16,204,205,206,209],{},"In the \"source\" parameter, we always insert the name of the website where the ad is displayed or the name of the company (platform) through which the ad space is served. In the \"source\" parameter, the word \"direct\" etc. can also appear as a reserved word in Google Analytics, so these reserved values should not be used in UTM parameters. Google Analytics automatically recognizes different sources of visits and if the source is not explicitly defined, it must be set. For example, when a visitor comes from an organic source, the source is assigned to the company that manages that search engine. In order to analyze the impact of a specific company on the traffic\u002Fprofit on your website, ",[23,207,208],{},"we recommend using the company name instead of the platform name"," when buying visits from multiple platforms (e.g. AdWords or Sklik), for example:",[51,211,212,218,224],{},[54,213,214,217],{},[23,215,216],{},"Google"," - the label for Google SERP (Search Engine Result Page), AdWords or merchant",[54,219,220,223],{},[23,221,222],{},"Seznam"," -the label for Seznam.cz, Zboží.cz or Sklik.cz",[54,225,226],{},"other",[16,228,229,230,118],{},"Often it is good to hide the source from which the customers came. The source is therefore identified by a code stored in an external table or added to the transformation filters in Google Analytics. Such a code is indicated by the prefix ",[80,231,232],{},"xd_",[16,234,235],{},"In case you use one or more platforms for ad distribution, it is necessary to distinguish through which tool the ad was purchased. In order to compare the performance of the platforms, the ad placement is created in the \"source\" as a combination of the platform name and the publisher's site name. The platform code should be then part of the \"source\" or alternatively inserted in the \"medium\".",[16,237,238],{},[23,239,240],{},"Platforms:",[51,242,243,246,249,252,255,258,261,264,267],{},[54,244,245],{},"adf (adform)",[54,247,248],{},"adb (adobe)",[54,250,251],{},"dtx (dataXu)",[54,253,254],{},"xnt (Xa.NET)",[54,256,257],{},"svp (silverpop)",[54,259,260],{},"unc (unica)",[54,262,263],{},"mch (Mail Chimp)",[54,265,266],{},"bee (PPC Bee)",[54,268,226],{},[16,270,271],{},[23,272,273],{},"Examples of use",[51,275,276,279,282,285,288,291],{},[54,277,278],{},"utm_source = google",[54,280,281],{},"utm_source = list",[54,283,284],{},"utm_source = heureka.cz",[54,286,287],{},"utm_source = xd_145eer47",[54,289,290],{},"utm_source = list~adf",[54,292,293],{},"utm_source = internal~svp (internal emails sent via Silverpop, if internal is too general and the purpose is, for example, to promote between internal websites, it can be replaced by the domain or company name from which the email addresses were obtained)",[97,295,297],{"id":296},"medium-utm_medium","Medium (utm_medium)",[16,299,300,301,304],{},"\"Medium\" refers to the medium or ",[23,302,303],{},"technology through which the visitor was brought to the site",". It also indicates the type of payment model used to pay for advertising. For example, when auto-tagging is turned on in AdWords, Google uses the CPC label but does not display any information about what medium was used. This information is passed between AdWords and Google Analytics internally. Some platforms use different codes for the same thing - CPM and CPT, for example. We, therefore, recommend that you standardize this terminology and use consistent codes. It is generally preferred to use the name of the medium for \"medium\" rather than the payment model type. This is because the medium has a higher information value for subsequent evaluation. For systems where there is no internal data aggregation, it will provide a wider range of information in return.",[16,306,307],{},[23,308,309],{},"Payment models",[51,311,312,315,318,321,324,327,330],{},[54,313,314],{},"CPC (cost per click)",[54,316,317],{},"CPM (cost per thousand)",[54,319,320],{},"CPT (cost per thousand)",[54,322,323],{},"CPV (cost per view)",[54,325,326],{},"CPA (cost per acquisition)",[54,328,329],{},"CPP (cost per point, price per affected population)",[54,331,226],{},[16,333,334],{},[23,335,336],{},"Medium",[51,338,339,342,345,348,351,354,357,360,363,366,369,372],{},[54,340,341],{},"product",[54,343,344],{},"email",[54,346,347],{},"affiliate",[54,349,350],{},"display \u002F banner",[54,352,353],{},"discount",[54,355,356],{},"social",[54,358,359],{},"offline",[54,361,362],{},"paid",[54,364,365],{},"post",[54,367,368],{},"job post (job advertisement)",[54,370,371],{},"fix (paid at a fixed price regardless of the number of impressions or clicks)",[54,373,226],{},[16,375,376],{},[23,377,273],{},[51,379,380,383,386,389,392],{},[54,381,382],{},"utm_medium = cpc",[54,384,385],{},"utm_medium = cpa",[54,387,388],{},"utm_medium = email",[54,390,391],{},"utm_medium = social",[54,393,394],{},"utm_medium = banner",[97,396,398],{"id":397},"campaign-utm_campaign","Campaign (utm_campaign)",[16,400,401,402,405],{},"\"Campaign\" is a complex attribute that should contain ",[23,403,404],{},"information about how, to whom, when, where, and for what purpose the ad was displayed",". For example, the objective of a campaign may be to promote brand, product, or service. It is important that the name of the campaign in the marketing platform is the same as the name in the UTM parameter. We recommend creating the campaign name as a composite attribute that contains metadata about the campaign itself, which will allow it to be compared with similar campaigns. For example, a campaign displayed in a SERP has a different performance than a campaign displayed as a banner on a web page.",[102,407,409],{"id":408},"display-type","Display type",[16,411,412],{},"Campaigns are classified by type and location:",[51,414,415,421,427,432,438],{},[54,416,417,420],{},[23,418,419],{},"s"," (search) - The ad is displayed in response to data provided by a user (SERP on Google or List).",[54,422,423,426],{},[23,424,425],{},"d"," (display, visual advertisement) - The advertisement is displayed in the form of a graphic or text element, the display is based on information collected about the user or about the website where the advertisement is displayed.",[54,428,429,431],{},[23,430,16],{}," (product, product search) - This is a combination of searches where a user enters a keyword and then displays a predominantly graphic element with an advertisement for a product or service.",[54,433,434,437],{},[23,435,436],{},"m"," (message) - A form of a paid message sent mainly on social media, such as Facebook's \"promoted page post\" or LinkedIn \"sponsored updates\".",[54,439,440,443],{},[23,441,442],{},"v"," (video) - A video ad shown on television programs or on YouTube that allows direct measuring.",[102,445,447],{"id":446},"targeting-type","Targeting type",[51,449,450,456,462],{},[54,451,452,455],{},[23,453,454],{},"r"," (remarketing \u002F retargeting, re-targeting) - re-targeting an already recognized visitor. This is the use of customer behavior information. For example, if a visitor abandons a cart, they are subsequently communicated via a display ad showing the content of their cart.",[54,457,458,461],{},[23,459,460],{},"bhv"," - behavioral targeting based on user’s behavior across the internet, their intent, interests, etc.",[54,463,464,467],{},[23,465,466],{},"src"," - search targeting based on user’s intent expressed by submitting specific keywords to search console.",[102,469,471],{"id":470},"segment-type","Segment type",[16,473,474,475],{},"It is necessary to distinguish whether the advertisement is intended to ",[23,476,477],{},"attract new visitors (acquisitions) or existing customers (retention).",[51,479,480,486,492],{},[54,481,482,485],{},[23,483,484],{},"l"," (lead) - Acquisition advertising aimed to acquire new contacts",[54,487,488,491],{},[23,489,490],{},"n"," (new) - Acquisition advertising aimed to acquire new customers",[54,493,494,497],{},[23,495,496],{},"c"," (customer) - Retention advertising aimed to maximize customer value",[102,499,501],{"id":500},"advertising-target","Advertising target",[16,503,504,505,508,509,512],{},"Advertising target ",[23,506,507],{},"specifies the subject of the advertisement that is being offered"," to the customer or ",[23,510,511],{},"indicates the customer's expected actions",". For a general advertisement for the sale of goods that targets by category, the category name will suffice; the higher level of detail can be specified at the report\u002Fadgroup level.",[138,514,515,517],{},[23,516,142],{},"\n\nIf an advertisement promotes hats, then you can use the word \"hats\" in the name.  It can also be a category, collection, brand, product, other, or a specific product name or a combination of the above.\n",[16,519,520,521,524,525,528,529,532,533,118],{},"Another option is to state the objective of the ad describing the customer behavior you want to achieve. Examples include campaigns aimed at completing an order or repurchasing. In this case, the name of the campaign should contain the phase of the shopping cycle in which the customer is currently located or the goal that he should achieve, respectively. what he should do, such as ",[80,522,523],{},"order_completion",", ",[80,526,527],{},"order_delivery_type",", etc. Similarly, it can be an action a visitor should take, such as ",[80,530,531],{},"register_demo"," or ",[80,534,535],{},"download_study",[16,537,538,541],{},[23,539,540],{},"You should always follow a terminology hierarchy"," - from left to right and from general to specific. However, the target of the ad can also be a group of search parameters that are included in a campaign.",[543,544,545,546,549,550],"tip",{},"\nIn a campaign to get the right keywords \n",[80,547,548],{},"s_broad","\n, campaign titles should always be in a single language. \n",[23,551,552],{},"We recommend using English names.",[102,554,556],{"id":555},"brand-advertising","Brand advertising",[16,558,559],{},"There are several types of brand campaigns. It is either an advertisement of your own brand, product promotion, or takeover of the competition.",[51,561,562,568,574],{},[54,563,564,567],{},[23,565,566],{},"brand or {brand}"," is an ad promoting your own brand",[54,569,570,573],{},[23,571,572],{},"interbrand_ {competing brand name}"," is an advertisement that captures visits to a competing brand",[54,575,576,579],{},[23,577,578],{},"intrabrand_ {product}"," is an ad for promoting products through the brand name of the product",[102,581,582],{"id":226},"Other",[16,584,585],{},"In \"Other\", provide further details of the campaign, such as:",[51,587,588,594,600,606],{},[54,589,590,593],{},[23,591,592],{},"type of motivator"," - eg \"sale\", \"promo\", \"bonus\",",[54,595,596,599],{},[23,597,598],{},"ad launch time"," - such as emails that are sent daily or weekly.",[54,601,602,605],{},[23,603,604],{},"campaign location"," - eg \"brno\", \"prague\", then e.g. \"branches\" or \"cz\"",[54,607,608,611],{},[23,609,610],{},"targeting"," men or women, etc.",[102,613,615],{"id":614},"reports-adgroup-advertisement","reports | adgroup | advertisement",[16,617,618,619,622],{},"Different platforms allow you to split campaigns into subgroups, reports, etc. A campaign is then a ",[23,620,621],{},"collection of different subsets",", for example, an AdGroup in AdWords. The parameter sent in the UTM should therefore include both the campaign name and the report name.",[138,624,625,627,629,630,632],{},[23,626,142],{},[144,628],{},"\n\n\nIf you have a campaign used for text search, it will be made of subgroups and its goal is to promote a brand, then the name of the campaign might look something like this for illustration:\n",[144,631],{},[80,633,634],{},"s_interbrand~{encrypted code of competing company}",[138,636,637,639,641,642,644],{},[23,638,142],{},[144,640],{},"\n\n\nA campaign that targets incomplete orders through remarketing could be named like this:\n",[144,643],{},[80,645,646],{},"dr_order_complete",[102,648,650],{"id":649},"date","Date",[16,652,653,654,657,658,118],{},"For recurring campaigns, ",[23,655,656],{},"we recommend adding the date the campaign was activated to the name of the campaign."," In an email campaign with the name \"Newsletter\", it is difficult to distinguish when specific emails were sent out. So for recurring email campaigns, we advise using the date as an additional parameter. In basic form, it is sufficient to have the code in YYMMDD format, but for better evaluation directly in Google Analytics, it is more efficient to extend the date code. Then you will be able to directly evaluate cyclical segments, for example, to compare the performance of a specific day. For ",[23,659,660],{},"campaigns sent weekly, we recommend using a code containing the week number",[138,662,663,665,667],{},[23,664,142],{},[144,666],{},"\n\n\nCampaigns coded code 21w46tu and 21w46we are sent in the 46th week (ISO week is used) on Tuesday, and Wednesday.\n",[138,669,670,672,674],{},[23,671,142],{},[144,673],{},"\n\n\nMonthly campaigns are assigned a code. For example, the 21m09w2tu campaign is a campaign submitted in September, the second week, and on Tuesday.\n",[16,676,677],{},"Codes to indicate the days of the week",[51,679,680,686,692,698,704,710,716],{},[54,681,682,685],{},[23,683,684],{},"mo"," (Monday)",[54,687,688,691],{},[23,689,690],{},"tu"," (Tuesday)",[54,693,694,697],{},[23,695,696],{},"we"," (Wednesday)",[54,699,700,703],{},[23,701,702],{},"th"," (Thursday)",[54,705,706,709],{},[23,707,708],{},"fr"," (Friday)",[54,711,712,715],{},[23,713,714],{},"sa"," (Saturday)",[54,717,718,721],{},[23,719,720],{},"su"," (Sunday)",[16,723,724],{},[23,725,726],{},"Values for the campaign name",[728,729,730],"figure",{},[731,732,733,756],"table",{},[734,735,736],"thead",{},[737,738,739,745,750],"tr",{},[702,740,741,742,741],{},"  ",[23,743,744],{},"Attribute name",[702,746,741,747,741],{},[23,748,749],{},"Allowed values",[702,751,741,752,755],{},[23,753,754],{},"Parameter","   ",[757,758,759,769,778,787,796,804,814],"tbody",{},[737,760,761,764,767],{},[762,763,409],"td",{},[762,765,766],{},"s,d,p,m,v",[762,768,190],{},[737,770,771,773,776],{},[762,772,447],{},[762,774,775],{},"r,src,bhv",[762,777,190],{},[737,779,780,782,785],{},[762,781,471],{},[762,783,784],{},"n,l,c",[762,786,190],{},[737,788,789,791,794],{},[762,790,501],{},[762,792,793],{},"See above for different values",[762,795,190],{},[737,797,798,800,802],{},[762,799,582],{},[762,801,793],{},[762,803,190],{},[737,805,806,809,812],{},[762,807,808],{},"Separator",[762,810,811],{},"\\~",[762,813,190],{},[737,815,816,818,820],{},[762,817,650],{},[762,819,793],{},[762,821,190],{},[97,823,825],{"id":824},"content-utm_content","Content (utm_content)",[16,827,828],{},"\"Content\" contains variations of sizes and texts in advertisements, types of banners used, etc. This parameter is useful for testing content.",[830,831,835],"external-link",{"title":832,"link":833,"button":834},"Waaila homepage","https:\u002F\u002Fwaaila.com","Go to Waaila","\nCheck your parameters with Waaila and validate your UTM tagging.\n",[97,837,839],{"id":838},"term-utm_term","Term (utm_term)",[16,841,842],{},"\"Term\" contains the keyword that was used for the search. The name of the website where the ad was displayed can be inserted in this parameter as well. You can also add the category of content that the visitor was browsing before clicking on the ad. For some types of campaigns, such as paid search, it is added automatically.",[16,844,845],{},[23,846,847],{},"Data transformation",[16,849,850],{},"A number of businesses use various distribution points or kiosks. A website visit from such a kiosk should therefore be recorded as a special campaign or medium. Such detection is done the best via a special Google Analytics setting.",[16,852,853,854,118],{},"A similar case are paid ads, where for some reason the use of the UTM parameters is not appropriate. For example, it could spoil the site's reputation or arouse suspicion among visitors. So if it is not appropriate to use UTM parameters, then the data transformation is done for example from ",[80,855,856],{},"document.referrer",[138,858,859,861,863,866],{},[23,860,142],{},[144,862],{},[80,864,865],{},"_bulbs.heureka.cz_","\n is transformed by inserting “bulbs” into the campaign name and to referrer path a custom variable is inserted.\n",[97,868,870],{"id":869},"id-utm_id","Id (utm_id)",[16,872,873,874,880,881,118],{},"Some companies are developing complex campaign tagging logic causing high complexity in values of utm parameters. A lot of information covered in URLs can be confusing for users and it may contain sensitive data about the marketing strategy of the company. Also, a number of utm parameters might not be sufficient and more campaign dimensions are needed for proper analysis. ",[23,875,876,877],{},"The complexity of sending all utm parameters can be avoided by using parameter ",[80,878,879],{},"utm_id",". It is an Id assigned to a specific campaign performed. In URL only this Id is sent, all additional parameters are stored separately in a table where you can store both standard and custom campaign dimensions. You can import this mapping table to Google Analytics and assign all the dimensions to specific ",[80,882,879],{},[138,884,885,887,889,890,893],{},[23,886,142],{},[144,888],{},"\n\n\nYou perform emailing campaign on discounted bulbs with a link to a specific product on your website. When assigning tags, instead of all utm parameters, you add \n",[80,891,892],{},"utm_id=123xyz","\n to URL of the link.\n",[16,895,896],{},"Then a table with mapping of your campaign dimensions needs to be created in the following structure:",[728,898,899],{},[731,900,901,902,901,924,901],{}," ",[734,903,901,904],{},[737,905,906,909,912,915,918,921],{},[702,907,908],{},"ga:campaignCode  ",[702,910,911],{},"ga:source  ",[702,913,914],{},"ga:medium  ",[702,916,917],{},"ga:campaign  ",[702,919,920],{},"ga:content  ",[702,922,923],{},"ga:dimension11",[757,925,926],{},[737,927,928,931,933,936,939,942],{},[762,929,930],{},"123xyz",[762,932,344],{},[762,934,935],{},"newsletter",[762,937,938],{},"m\\~bulb\\~disc",[762,940,941],{},"bulbs",[762,943,944],{},"competitor_name",[16,946,947,948,118],{},"To import the data in Google Analytics, you can either import it as .csv file or use management API. Detailed information about the campaign data import can be found ",[949,950,954],"a",{"href":951,"rel":952},"https:\u002F\u002Fsupport.google.com\u002Fanalytics\u002Fanswer\u002F4522476?hl=en",[953],"nofollow","here",[11,956,958],{"id":957},"conclusion","Conclusion",[16,960,961,962,118],{},"Congratulations, you read the article to the end! We believe that the information has been beneficial to you and helped you orient yourself in the wild waters of the campaign naming typology. The most important thing to remember is: ",[23,963,964],{},"stay consistent and aligned with marketing strategy",[16,966,967],{},"Thanks to mutual discussion and feedback, we can inspire each other and be one step further. Share with us your observation, knowledge, tips, and original solutions from your experience.",[969,970,973],"action",{"link":971,"button":972},"\u002Fen\u002Fget-in-touch\u002F","Contact Us","\nIf you do not fully understand something listed here or would like to s discuss specific issues, contact us. We can answer your questions and help you with your campaign tagging.\n",{"title":35,"searchDepth":975,"depth":975,"links":976},2,[977,978,979,985,993],{"id":13,"depth":975,"text":14},{"id":39,"depth":975,"text":40},{"id":68,"depth":975,"text":69,"children":980},[981,983,984],{"id":99,"depth":982,"text":100},3,{"id":152,"depth":982,"text":153},{"id":173,"depth":982,"text":174},{"id":197,"depth":975,"text":198,"children":986},[987,988,989,990,991,992],{"id":201,"depth":982,"text":202},{"id":296,"depth":982,"text":297},{"id":397,"depth":982,"text":398},{"id":824,"depth":982,"text":825},{"id":838,"depth":982,"text":839},{"id":869,"depth":982,"text":870},{"id":957,"depth":975,"text":958},"Guides","md","\u002Fupload\u002Futm-parameters-illustration.webp",false,{"externalLinks":999},[1000],{"url":1001,"name":1002},"https:\u002F\u002Fcrossmasters.com\u002Fen\u002Fproducts\u002Fmeasurement-hub","Measurement Hub",true,"\u002Fen\u002Fblog\u002Fhow-to-optimize-utm-for-uniform-campaign-typology","2012-10-14T09:38:00.000+00:00",16.5,"17 min read",[1009,1010],"content\u002Fen\u002Fblog\u002Fincrease-conversions-with-category-page-product-ranking.md","content\u002Fen\u002Fblog\u002Fnew-data-api-for-google-analytics-4.md",{"title":5,"description":35},"en\u002Fblog\u002Fhow-to-optimize-utm-for-uniform-campaign-typology","Advance online campaign management with UTM parameters, structure unification, and enrichment for more detailed performance evaluation.","2021-05-23T10:00:00.000+00:00","_IXRpSI1KvvsQqvbLoNJQ96SB05Q8MNokWoDAJkBXgQ",[1017,1250],{"id":1018,"title":1019,"author":6,"body":1020,"category":1236,"description":1024,"extension":995,"image":1237,"isToc":997,"langAlt":6,"meta":1238,"metaDescription":6,"navigation":1003,"path":1239,"published":1003,"publishedAt":1240,"readingTimeMinutes":1241,"readingTimeText":1242,"relatedArticles":1243,"seo":1246,"stem":1247,"teaser":1248,"updatedAtCustom":6,"__hash__":1249},"blog_en\u002Fen\u002Fblog\u002Fincrease-conversions-with-category-page-product-ranking.md","Increase conversions with category page product ranking",{"type":8,"value":1021,"toc":1223},[1022,1025,1032,1036,1039,1043,1046,1050,1053,1057,1060,1064,1067,1072,1076,1079,1083,1086,1090,1093,1097,1100,1104,1107,1111,1114,1117,1121,1124,1128,1131,1135,1138,1186,1190,1193,1210,1213,1220],[16,1023,1024],{},"Traditionally, e-commerce retailers and marketers pay most of their attention to developing product pages and checkout pages, because that is where the sales happen. However, we need to look at the previous steps, before the checkout. Customers use category pages to understand the offers of the e-shop, in other words, category pages become the attraction locations.",[16,1026,1027,1028,1031],{},"When a customer comes to an e-shop and looks for a product, category pages drive the majority of the site product discovery ranging between 50 - 70%, compared with other options, search results and recommendation sites bring around 10% each. This may seem like a lot and that there is not much to be improved. Nevertheless, t",[23,1029,1030],{},"he issue is in the progress from the category page."," When the category page is not compelling enough, customers are unlikely to reach the individual product page. Less than half of that traffic really proceeds to the product page. Customers probably did not find what they were looking for, the products were not relevant or outside their price range. By optimizing category pages, you can double the product discovery and increase the profit. Additionally, it builds a website structure, improves SEO, and subsequent remarketing advertising.",[11,1033,1035],{"id":1034},"improving-category-pages","Improving category pages",[16,1037,1038],{},"Driving targeted traffic to category pages has been a topic of many marketers’ discussion. Commonly they have already adopted some improvements. The “science” behind the sales-driving category pages lies in displaying the optimal combination of selected products, counting on the limited number of the showed pieces. Here are just two examples, how usually e-shops try to tackle category pages:",[102,1040,1042],{"id":1041},"manual-optimization","Manual optimization",[16,1044,1045],{},"The cooperation with many e-commerce businesses helped us understand that many e-shops are trying to optimize the category pages, however, they do it manually and rely on their own intuition rather than customer’s behavior. Manual arrangements can take days resulting in wasted resources; energy, time, and finances. The outcome of such activities costs more than they actually bring. Secondly, the changes cannot be applied fast enough to satisfy the customers’ needs.",[102,1047,1049],{"id":1048},"category-page-ads","Category Page Ads",[16,1051,1052],{},"Targeting traffic via ads is another option of how to increase conversion rates. If done correctly it can bring a significant increase. On the other hand, the actual return on the investment is lower, taking the ad spent into consideration.",[11,1054,1056],{"id":1055},"how-to-optimize-category-pages-deliver-better-results","How to optimize category pages & deliver better results",[16,1058,1059],{},"The optimization of category pages can be crucial in getting more website traffic, converting it to sales, and creating loyal customers from first-time shoppers. It is important to provide a valuable digital experience. When the category page doesn’t deliver what the customers expected, they leave without a purchase, not finding what they wanted. Relevancy is what matters. A crucial prerequisite to any calculation is historical data on products, sales, segments, etc. Without enough data, the results cannot be as satisfying.",[97,1061,1063],{"id":1062},"personalization-and-product-recommendations","Personalization and product recommendations",[16,1065,1066],{},"The category pages need to be personalized to be able to achieve different goals for different segments. Adding a layer of personalization to different audiences’ levels up simple segmentation and yields higher returns. With first-time customers, you will probably focus on conversion rate while with loyal customers you can highlight a particular brand based on brand affinity, new products to complement already purchased ones, or something a little more diverse, depending on the customer profile. Assigning different products to each segment, based on the customer’s behavior on-site increases customer engagement. Tracking how the customer acts on the websites helps to understand their needs and display relevant items. If two people are looking for backpacks, they might be looking for a different kind. If one person is shopping for notepads, writing supplies, it is likely they will also need a school backpack. A different customer is looking at hiking boots and camping gear and might need a hiking backpack.",[16,1068,1069],{},[33,1070],{"alt":35,"src":1071},"\u002Fupload\u002Fproduct-recomendation-illustration.jpg",[102,1073,1075],{"id":1074},"sorting","Sorting",[16,1077,1078],{},"Sorting products on the site in specific order or sequence based on their attributes, performance metrics, and their combination. The attributes can be price, size, brand, availability, etc. Metrics can be, for example, conversion rate, margin, revenue per impression, or inventory information. Attributes and metrics rely on the data about the products and the customers, collected from the website and internal databases. By adjusting the weights of the values, it is possible to promote and demote products in the sequence causing the relocation of the product on the page.",[102,1080,1082],{"id":1081},"highlighting","Highlighting",[16,1084,1085],{},"Choosing to highlight specific products or groups of products, seasonal or campaign offers at the top of the category page supports marketing efforts. Placing some products on the most engaging and prominent spots on the sites creates a store-like experience. It is commonly used to promote new products, collaborations, and ranges. Highlighting can work for limited offers (discounts or weekend sales) and display products for a certain time period. Scheduling this should be aligned with marketing campaigns. Another option to adjust highlighting can be based on different business goals, chosen metrics, like profitability or liquidity.",[102,1087,1089],{"id":1088},"segmentation","Segmentation",[16,1091,1092],{},"Segmenting your customers should happen on top of sorting and highlighting products. It allows creating category pages with specific product sequences that vary among different audiences. The marketing approach differs by different types of customers, their preferences, affinity, and different shopping stages, therefore category pages should be aligned with that as well.",[102,1094,1096],{"id":1095},"personalization","Personalization",[16,1098,1099],{},"Showing the customers what they want to buy, the right time, the right product – like a personal shopper. It helps customers to discover items they really want. In e-commerce, personalization has a more significant impact and is an important part of modern shopping. It provides relevant recommendations for the particular customer segment (or with advanced algorithms, even down to each individual customer). Personalization creates an experience based on the customer’s behavior.",[11,1101,1103],{"id":1102},"using-machine-learning-for-relevant-product-displaying","Using Machine Learning for relevant product displaying",[16,1105,1106],{},"Powering product recommendation with Machine learning allows you to be dynamic and automatically adapt to the changes. What customers want to see is what they really need, ideally on the very first page. Long searching is demotivating. Using historic purchases, similar customer behavior, or other factors can significantly change the way your customers interact with your e-shop.",[97,1108,1110],{"id":1109},"product-ranking-based-on-customers-behavior-and-other-factors","Product ranking based on customers behavior and other factors",[16,1112,1113],{},"Product ranking in a sense of algorithms is a process of product scoring based on what the customers like. Additionally, the score can be evaluated based on the factors the e-shop defines, for example, storage availability (the more pieces of each product you have and need to sell, the higher score it gets). What we have found as an effective method is to look more deeply and find the optimal combination of the products display next to each other. Our procedure usually consists of data integration from various systems, followed by advanced analytics and machine learning algorithms for continual improvement.",[74,1115,1116],{},"\nTo understand what product ranking is, think of it as product ranking from the system perspective, not as customer review. The ranking that you calculate helps the algorithm to show the right products on the category page.\n",[97,1118,1120],{"id":1119},"testing-and-optimization","Testing and optimization",[16,1122,1123],{},"Finding an optimal solution isn’t an easy task, especially when personalization and merchandising are dynamic, evolving processes requiring repetition, calculation, and testing. AB Testing is a great approach for detecting the most profitable adjustments. It helps to discover the performance of different category pages or the effectiveness of product highlighting. It allows you to test competing strategies and make informed decisions for elevated results. It is possible to test a whole customer base or just a smaller part. With testing on different groups, you can experiment with bold ideas. You can see if sorting by high converting products is better than sorting by high-profit products. Or, you can assess if personalization delivers higher results than no personalization on category pages.",[97,1125,1127],{"id":1126},"continuous-improvement","Continuous improvement",[16,1129,1130],{},"Once you set up the algorithms for relevant product displaying, you are not done yet. It is only a first step but not the last. Actually, the process is evolving, and you cannot stay static. Sometimes the results are oversimplified or too generalized, and you need to use more contextual data to improve the relevance. Thinking of it in the context of the customer journey helps to maintain the dynamics within the product associations.",[11,1132,1134],{"id":1133},"what-to-think-about-before-diving-in","What to think about before diving in",[16,1136,1137],{},"Are you hooked yet? Ready to dive your e-commerce business into the ocean of personalization? Slow down a little bit. There are a few things to think about before you do any action.",[51,1139,1140,1148,1154,1162,1170,1178],{},[54,1141,1142,1145,1147],{},[23,1143,1144],{},"Make sure your website is ready!",[144,1146],{},"Some technology can decrease performance. Even if the personalization is great, it should not be implemented if the usability is diminished.",[54,1149,1150,1151,1153],{},"**Don’t change the entire website!",[144,1152],{},"\n**Structural elements cannot be personalized, they should remain the same (cart, navigation panel, etc.)",[54,1155,1156,1159,1161],{},[23,1157,1158],{},"Less is more!",[144,1160],{},"Too much of everything is confusing, too dynamic can be misleading. The key is not to look at personalization.",[54,1163,1164,1167,1169],{},[23,1165,1166],{},"Prepare your data!",[144,1168],{},"Before you start the analyses and evaluations, gather all relevant data, the more historic data the better.",[54,1171,1172,1175,1177],{},[23,1173,1174],{},"Identify key factors!",[144,1176],{},"Figure out, how you want to score\u002Frank\u002Frecommend the content. Do you need to clear your warehouse or promote more trendy items? What about seasonal stuff? Segmented or more individualized? More factors and segments, the more complicated and expensive it gets.",[54,1179,1180,1183,1185],{},[23,1181,1182],{},"Start small!",[144,1184],{},"Try only a few changes first, test them, and then you can see if it is worth it to advance or not.",[11,1187,1189],{"id":1188},"summary","Summary",[16,1191,1192],{},"Successful category pages drive performance and contribute to growing conversion and return ratios. Optimizing them generates a competitive advantage and brings multiple benefits to your e-commerce business and customers.",[51,1194,1195,1198,1201,1204,1207],{},[54,1196,1197],{},"Resource savings with automatization",[54,1199,1200],{},"Better performance with category pages optimization",[54,1202,1203],{},"Relevant experiences with personalization",[54,1205,1206],{},"Achieving more than one target with optimization and testing",[54,1208,1209],{},"Easy to scale with a growing product portfolio",[16,1211,1212],{},"It may seem super easy, just to set up a few rules and you are good to go. However, working with a large amount of data and continuous training of the algorithms is tricky. Rather than DIY everything, cooperating with more experienced professionals prevents the risk of “breaking it all” and losing your customers to it.",[16,1214,1215,1216,1219],{},"We have effectively set up the product ranking and relevant recommendations on category pages for many of our clients and helped them to ",[23,1217,1218],{},"achieve a 15-27% increase"," in the conversion only a few weeks after implementing the solution. We have been able to customize the solution based on different business needs and continuously improve the solution thanks to testing.",[969,1221,1222],{"link":971,"button":972},"\nCome to us today and help your customers to find the desired item tomorrow.\n",{"title":35,"searchDepth":975,"depth":975,"links":1224},[1225,1226,1229,1234,1235],{"id":1034,"depth":975,"text":1035},{"id":1055,"depth":975,"text":1056,"children":1227},[1228],{"id":1062,"depth":982,"text":1063},{"id":1102,"depth":975,"text":1103,"children":1230},[1231,1232,1233],{"id":1109,"depth":982,"text":1110},{"id":1119,"depth":982,"text":1120},{"id":1126,"depth":982,"text":1127},{"id":1133,"depth":975,"text":1134},{"id":1188,"depth":975,"text":1189},"Company","\u002Fupload\u002Fcategoryranking-article-cover.webp",{},"\u002Fen\u002Fblog\u002Fincrease-conversions-with-category-page-product-ranking","2020-11-06T10:10:50.000+00:00",9.12,"10 min read",[1244,1245],"content\u002Fen\u002Fblog\u002Fgetting-the-most-out-of-permission-marketing.md","content\u002Fen\u002Fblog\u002Fmachine-learning-in-marketing-practice.md",{"title":1019,"description":1024},"en\u002Fblog\u002Fincrease-conversions-with-category-page-product-ranking","Online market is becoming very saturated and crowded with hundreds of e-shops, and the number is increasing. To keep up with the competition, every internet store must create a unique approach, provide enjoyable shopping and know its customers.","jo4l7QC10gq9zQLNdkKbEgxJz9GV44x0803c8Kv8BkM",{"id":1251,"title":1252,"author":6,"body":1253,"category":6,"description":5454,"extension":995,"image":5455,"isToc":997,"langAlt":6,"meta":5456,"metaDescription":5457,"navigation":1003,"path":5458,"published":1003,"publishedAt":5459,"readingTimeMinutes":5460,"readingTimeText":5461,"relatedArticles":5462,"seo":5465,"stem":5466,"teaser":5467,"updatedAtCustom":5468,"__hash__":5469},"blog_en\u002Fen\u002Fblog\u002Fnew-data-api-for-google-analytics-4.md","New Data API for Google Analytics 4",{"type":8,"value":1254,"toc":5438},[1255,1270,1278,1288,1298,1301,1305,1317,1323,1326,1367,1372,1654,1659,1910,1914,1917,1957,1962,2428,2433,2943,2946,2950,2954,2957,2984,3189,3193,3200,3221,3224,3246,3704,3733,3737,3752,3755,3758,3764,4298,4307,4311,4325,4330,4333,4338,4342,4352,4355,4710,4714,4730,4733,4736,4760,5024,5085,5091,5095,5098,5109,5136,5143,5152,5160,5168,5399,5401,5404,5431,5434],[16,1256,1257,1258,1261,1262,1265,1266,1269],{},"The ",[23,1259,1260],{},"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 ",[23,1263,1264],{},"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 ",[23,1267,1268],{},"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.",[74,1271,1272,1273,95],{},"\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",[949,1274,1277],{"href":1275,"rel":1276},"https:\u002F\u002Fcrossmasters.com\u002Fen\u002Fblog\u002Fnotes-on-new-features-of-google-analytics-reporting-api-v4\u002F",[953],"the article dedicated to UA API",[16,1279,1280,1281,1287],{},"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 ",[23,1282,1283],{},[1284,1285,1286],"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.",[543,1289,1290,1291,1297],{},"\nFor testing queries to the GA4 API you can also use the \n",[949,1292,1296],{"href":1293,"rel":1294,"title":1295},"https:\u002F\u002Fwaaila.com\u002F",[953],"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",[16,1299,1300],{},"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.",[11,1302,1304],{"id":1303},"one-simple-query-querying-data-using-runreport-method","One simple query - querying data using runReport method",[16,1306,1307,1308,1311,1312,1316],{},"The easiest way to extract data is using the ",[23,1309,1310],{},"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 ",[949,1313,1314],{"href":1314,"rel":1315},"https:\u002F\u002Fanalyticsdata.googleapis.com\u002Fv1beta\u002F",[953],"\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.",[97,1318,1320],{"id":1319},"differences-between-data-queries",[23,1321,1322],{},"Differences between data queries",[16,1324,1325],{},"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.",[1327,1328,1329,1332,1350],"ol",{},[54,1330,1331],{},"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).",[54,1333,1334,1335,1338,1339,1342,1343,1346,1347,1349],{},"The GA4 API introduced ",[23,1336,1337],{},"consistency"," between specifying dimensions’ and metrics’ names because names of both metrics and dimensions are specified in parameter ",[80,1340,1341],{},"name",", not ",[80,1344,1345],{},"expression"," for metrics and ",[80,1348,1341],{}," for dimensions as before.",[54,1351,1352,1353,1356,1357,1360,1361,901,1363,1366],{},"Lastly, the ",[80,1354,1355],{},"orderBys"," has a slightly different structure, where you ",[23,1358,1359],{},"differentiate"," if you order by ",[23,1362,949],{},[23,1364,1365],{},"dimension, a metric, or a pivot group"," and you specify the direction of ordering for all listed columns together.",[16,1368,1369],{},[1284,1370,1371],{},"The query for GA4 example",[1373,1374,1378],"pre",{"className":1375,"code":1376,"language":1377,"meta":35,"style":35},"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",[80,1379,1380,1389,1407,1412,1438,1458,1464,1470,1484,1489,1507,1512,1517,1531,1536,1553,1558,1563,1576,1581,1596,1616,1622,1637,1642,1648],{"__ignoreMap":35},[1381,1382,1385],"span",{"class":1383,"line":1384},"line",1,[1381,1386,1388],{"class":1387},"sAklC","{\n",[1381,1390,1391,1394,1398,1401,1404],{"class":1383,"line":975},[1381,1392,1393],{"class":1387},"  \"",[1381,1395,1397],{"class":1396},"sJ14y","dateRanges",[1381,1399,1400],{"class":1387},"\"",[1381,1402,1403],{"class":1387},":",[1381,1405,1406],{"class":1387}," [\n",[1381,1408,1409],{"class":1383,"line":982},[1381,1410,1411],{"class":1387},"    {\n",[1381,1413,1415,1418,1422,1424,1426,1429,1433,1435],{"class":1383,"line":1414},4,[1381,1416,1417],{"class":1387},"      \"",[1381,1419,1421],{"class":1420},"s5Dmg","startDate",[1381,1423,1400],{"class":1387},[1381,1425,1403],{"class":1387},[1381,1427,1428],{"class":1387}," \"",[1381,1430,1432],{"class":1431},"sfyAc","2021-01-04",[1381,1434,1400],{"class":1387},[1381,1436,1437],{"class":1387},",\n",[1381,1439,1441,1443,1446,1448,1450,1452,1455],{"class":1383,"line":1440},5,[1381,1442,1417],{"class":1387},[1381,1444,1445],{"class":1420},"endDate",[1381,1447,1400],{"class":1387},[1381,1449,1403],{"class":1387},[1381,1451,1428],{"class":1387},[1381,1453,1454],{"class":1431},"2021-01-06",[1381,1456,1457],{"class":1387},"\"\n",[1381,1459,1461],{"class":1383,"line":1460},6,[1381,1462,1463],{"class":1387},"    }\n",[1381,1465,1467],{"class":1383,"line":1466},7,[1381,1468,1469],{"class":1387},"  ],\n",[1381,1471,1473,1475,1478,1480,1482],{"class":1383,"line":1472},8,[1381,1474,1393],{"class":1387},[1381,1476,1477],{"class":1396},"metrics",[1381,1479,1400],{"class":1387},[1381,1481,1403],{"class":1387},[1381,1483,1406],{"class":1387},[1381,1485,1487],{"class":1383,"line":1486},9,[1381,1488,1411],{"class":1387},[1381,1490,1492,1494,1496,1498,1500,1502,1505],{"class":1383,"line":1491},10,[1381,1493,1417],{"class":1387},[1381,1495,1341],{"class":1420},[1381,1497,1400],{"class":1387},[1381,1499,1403],{"class":1387},[1381,1501,1428],{"class":1387},[1381,1503,1504],{"class":1431},"sessions",[1381,1506,1457],{"class":1387},[1381,1508,1510],{"class":1383,"line":1509},11,[1381,1511,1463],{"class":1387},[1381,1513,1515],{"class":1383,"line":1514},12,[1381,1516,1469],{"class":1387},[1381,1518,1520,1522,1525,1527,1529],{"class":1383,"line":1519},13,[1381,1521,1393],{"class":1387},[1381,1523,1524],{"class":1396},"dimensions",[1381,1526,1400],{"class":1387},[1381,1528,1403],{"class":1387},[1381,1530,1406],{"class":1387},[1381,1532,1534],{"class":1383,"line":1533},14,[1381,1535,1411],{"class":1387},[1381,1537,1539,1541,1543,1545,1547,1549,1551],{"class":1383,"line":1538},15,[1381,1540,1417],{"class":1387},[1381,1542,1341],{"class":1420},[1381,1544,1400],{"class":1387},[1381,1546,1403],{"class":1387},[1381,1548,1428],{"class":1387},[1381,1550,649],{"class":1431},[1381,1552,1457],{"class":1387},[1381,1554,1556],{"class":1383,"line":1555},16,[1381,1557,1463],{"class":1387},[1381,1559,1561],{"class":1383,"line":1560},17,[1381,1562,1469],{"class":1387},[1381,1564,1566,1568,1570,1572,1574],{"class":1383,"line":1565},18,[1381,1567,1393],{"class":1387},[1381,1569,1355],{"class":1396},[1381,1571,1400],{"class":1387},[1381,1573,1403],{"class":1387},[1381,1575,1406],{"class":1387},[1381,1577,1579],{"class":1383,"line":1578},19,[1381,1580,1411],{"class":1387},[1381,1582,1584,1586,1589,1591,1593],{"class":1383,"line":1583},20,[1381,1585,1417],{"class":1387},[1381,1587,1588],{"class":1420},"metric",[1381,1590,1400],{"class":1387},[1381,1592,1403],{"class":1387},[1381,1594,1595],{"class":1387}," {\n",[1381,1597,1599,1602,1606,1608,1610,1612,1614],{"class":1383,"line":1598},21,[1381,1600,1601],{"class":1387},"        \"",[1381,1603,1605],{"class":1604},"sx098","metricName",[1381,1607,1400],{"class":1387},[1381,1609,1403],{"class":1387},[1381,1611,1428],{"class":1387},[1381,1613,1504],{"class":1431},[1381,1615,1457],{"class":1387},[1381,1617,1619],{"class":1383,"line":1618},22,[1381,1620,1621],{"class":1387},"      },\n",[1381,1623,1625,1627,1630,1632,1634],{"class":1383,"line":1624},23,[1381,1626,1417],{"class":1387},[1381,1628,1629],{"class":1420},"desc",[1381,1631,1400],{"class":1387},[1381,1633,1403],{"class":1387},[1381,1635,1636],{"class":1387}," true\n",[1381,1638,1640],{"class":1383,"line":1639},24,[1381,1641,1463],{"class":1387},[1381,1643,1645],{"class":1383,"line":1644},25,[1381,1646,1647],{"class":1387},"  ]\n",[1381,1649,1651],{"class":1383,"line":1650},26,[1381,1652,1653],{"class":1387},"}\n",[16,1655,1656],{},[1284,1657,1658],{},"The query for UA for comparison",[1373,1660,1662],{"className":1375,"code":1661,"language":1377,"meta":35,"style":35},"{\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",[80,1663,1664,1668,1688,1700,1704,1722,1738,1742,1746,1758,1762,1781,1795,1799,1803,1815,1819,1836,1840,1844,1856,1860,1880,1898,1902,1906],{"__ignoreMap":35},[1381,1665,1666],{"class":1383,"line":1384},[1381,1667,1388],{"class":1387},[1381,1669,1670,1672,1675,1677,1679,1681,1684,1686],{"class":1383,"line":975},[1381,1671,1393],{"class":1387},[1381,1673,1674],{"class":1396},"viewId",[1381,1676,1400],{"class":1387},[1381,1678,1403],{"class":1387},[1381,1680,1428],{"class":1387},[1381,1682,1683],{"class":1431},"XXXXXXXXX",[1381,1685,1400],{"class":1387},[1381,1687,1437],{"class":1387},[1381,1689,1690,1692,1694,1696,1698],{"class":1383,"line":982},[1381,1691,1393],{"class":1387},[1381,1693,1397],{"class":1396},[1381,1695,1400],{"class":1387},[1381,1697,1403],{"class":1387},[1381,1699,1406],{"class":1387},[1381,1701,1702],{"class":1383,"line":1414},[1381,1703,1411],{"class":1387},[1381,1705,1706,1708,1710,1712,1714,1716,1718,1720],{"class":1383,"line":1440},[1381,1707,1417],{"class":1387},[1381,1709,1421],{"class":1420},[1381,1711,1400],{"class":1387},[1381,1713,1403],{"class":1387},[1381,1715,1428],{"class":1387},[1381,1717,1432],{"class":1431},[1381,1719,1400],{"class":1387},[1381,1721,1437],{"class":1387},[1381,1723,1724,1726,1728,1730,1732,1734,1736],{"class":1383,"line":1460},[1381,1725,1417],{"class":1387},[1381,1727,1445],{"class":1420},[1381,1729,1400],{"class":1387},[1381,1731,1403],{"class":1387},[1381,1733,1428],{"class":1387},[1381,1735,1454],{"class":1431},[1381,1737,1457],{"class":1387},[1381,1739,1740],{"class":1383,"line":1466},[1381,1741,1463],{"class":1387},[1381,1743,1744],{"class":1383,"line":1472},[1381,1745,1469],{"class":1387},[1381,1747,1748,1750,1752,1754,1756],{"class":1383,"line":1486},[1381,1749,1393],{"class":1387},[1381,1751,1477],{"class":1396},[1381,1753,1400],{"class":1387},[1381,1755,1403],{"class":1387},[1381,1757,1406],{"class":1387},[1381,1759,1760],{"class":1383,"line":1491},[1381,1761,1411],{"class":1387},[1381,1763,1764,1766,1768,1770,1772,1774,1777,1779],{"class":1383,"line":1509},[1381,1765,1417],{"class":1387},[1381,1767,1345],{"class":1420},[1381,1769,1400],{"class":1387},[1381,1771,1403],{"class":1387},[1381,1773,1428],{"class":1387},[1381,1775,1776],{"class":1431},"ga:sessions",[1381,1778,1400],{"class":1387},[1381,1780,1437],{"class":1387},[1381,1782,1783,1785,1788,1790,1792],{"class":1383,"line":1514},[1381,1784,1417],{"class":1387},[1381,1786,1787],{"class":1420},"alias",[1381,1789,1400],{"class":1387},[1381,1791,1403],{"class":1387},[1381,1793,1794],{"class":1387}," \"\"\n",[1381,1796,1797],{"class":1383,"line":1519},[1381,1798,1463],{"class":1387},[1381,1800,1801],{"class":1383,"line":1533},[1381,1802,1469],{"class":1387},[1381,1804,1805,1807,1809,1811,1813],{"class":1383,"line":1538},[1381,1806,1393],{"class":1387},[1381,1808,1524],{"class":1396},[1381,1810,1400],{"class":1387},[1381,1812,1403],{"class":1387},[1381,1814,1406],{"class":1387},[1381,1816,1817],{"class":1383,"line":1555},[1381,1818,1411],{"class":1387},[1381,1820,1821,1823,1825,1827,1829,1831,1834],{"class":1383,"line":1560},[1381,1822,1417],{"class":1387},[1381,1824,1341],{"class":1420},[1381,1826,1400],{"class":1387},[1381,1828,1403],{"class":1387},[1381,1830,1428],{"class":1387},[1381,1832,1833],{"class":1431},"ga:date",[1381,1835,1457],{"class":1387},[1381,1837,1838],{"class":1383,"line":1565},[1381,1839,1463],{"class":1387},[1381,1841,1842],{"class":1383,"line":1578},[1381,1843,1469],{"class":1387},[1381,1845,1846,1848,1850,1852,1854],{"class":1383,"line":1583},[1381,1847,1393],{"class":1387},[1381,1849,1355],{"class":1396},[1381,1851,1400],{"class":1387},[1381,1853,1403],{"class":1387},[1381,1855,1406],{"class":1387},[1381,1857,1858],{"class":1383,"line":1598},[1381,1859,1411],{"class":1387},[1381,1861,1862,1864,1867,1869,1871,1873,1876,1878],{"class":1383,"line":1618},[1381,1863,1417],{"class":1387},[1381,1865,1866],{"class":1420},"sortOrder",[1381,1868,1400],{"class":1387},[1381,1870,1403],{"class":1387},[1381,1872,1428],{"class":1387},[1381,1874,1875],{"class":1431},"DESCENDING",[1381,1877,1400],{"class":1387},[1381,1879,1437],{"class":1387},[1381,1881,1882,1884,1887,1889,1891,1893,1896],{"class":1383,"line":1624},[1381,1883,1417],{"class":1387},[1381,1885,1886],{"class":1420},"fieldName",[1381,1888,1400],{"class":1387},[1381,1890,1403],{"class":1387},[1381,1892,1428],{"class":1387},[1381,1894,1895],{"class":1431},"ga:users",[1381,1897,1457],{"class":1387},[1381,1899,1900],{"class":1383,"line":1639},[1381,1901,1463],{"class":1387},[1381,1903,1904],{"class":1383,"line":1644},[1381,1905,1647],{"class":1387},[1381,1907,1908],{"class":1383,"line":1650},[1381,1909,1653],{"class":1387},[97,1911,1913],{"id":1912},"differences-between-results","Differences between results",[16,1915,1916],{},"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.",[1327,1918,1919,1926,1950],{},[54,1920,1921,1922,1925],{},"The values for ",[23,1923,1924],{},"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.",[54,1927,1928,1931,1932,1935,1936,524,1939,524,1942,1945,1946,1949],{},[23,1929,1930],{},"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 ",[80,1933,1934],{},"metricAggregations"," with options ",[80,1937,1938],{},"TOTAL",[80,1940,1941],{},"MINIMUM",[80,1943,1944],{},"MAXIMUM",", and ",[80,1947,1948],{},"COUNT",". Therefore, you can receive the same information as through the original API but you won’t get it automatically.",[54,1951,1952,1953,1956],{},"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 ",[23,1954,1955],{},"consistency in presenting values"," and in querying the names of metrics and dimensions.",[16,1958,1959],{},[1284,1960,1961],{},"The results from GA4 example:",[1373,1963,1965],{"className":1375,"code":1964,"language":1377,"meta":35,"style":35},"{\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",[80,1966,1967,1971,1984,1988,2006,2024,2028,2032,2045,2049,2062,2067,2086,2091,2096,2109,2113,2130,2134,2139,2144,2148,2160,2164,2181,2185,2189,2202,2207,2225,2230,2235,2240,2245,2258,2263,2281,2286,2291,2304,2309,2327,2332,2337,2342,2347,2362,2376,2381,2398,2403,2408,2423],{"__ignoreMap":35},[1381,1968,1969],{"class":1383,"line":1384},[1381,1970,1388],{"class":1387},[1381,1972,1973,1975,1978,1980,1982],{"class":1383,"line":975},[1381,1974,1393],{"class":1387},[1381,1976,1977],{"class":1396},"metricHeaders",[1381,1979,1400],{"class":1387},[1381,1981,1403],{"class":1387},[1381,1983,1406],{"class":1387},[1381,1985,1986],{"class":1383,"line":982},[1381,1987,1411],{"class":1387},[1381,1989,1990,1992,1994,1996,1998,2000,2002,2004],{"class":1383,"line":1414},[1381,1991,1417],{"class":1387},[1381,1993,1341],{"class":1420},[1381,1995,1400],{"class":1387},[1381,1997,1403],{"class":1387},[1381,1999,1428],{"class":1387},[1381,2001,1504],{"class":1431},[1381,2003,1400],{"class":1387},[1381,2005,1437],{"class":1387},[1381,2007,2008,2010,2013,2015,2017,2019,2022],{"class":1383,"line":1440},[1381,2009,1417],{"class":1387},[1381,2011,2012],{"class":1420},"type",[1381,2014,1400],{"class":1387},[1381,2016,1403],{"class":1387},[1381,2018,1428],{"class":1387},[1381,2020,2021],{"class":1431},"TYPE_INTEGER",[1381,2023,1457],{"class":1387},[1381,2025,2026],{"class":1383,"line":1460},[1381,2027,1463],{"class":1387},[1381,2029,2030],{"class":1383,"line":1466},[1381,2031,1469],{"class":1387},[1381,2033,2034,2036,2039,2041,2043],{"class":1383,"line":1472},[1381,2035,1393],{"class":1387},[1381,2037,2038],{"class":1396},"rows",[1381,2040,1400],{"class":1387},[1381,2042,1403],{"class":1387},[1381,2044,1406],{"class":1387},[1381,2046,2047],{"class":1383,"line":1486},[1381,2048,1411],{"class":1387},[1381,2050,2051,2053,2056,2058,2060],{"class":1383,"line":1491},[1381,2052,1417],{"class":1387},[1381,2054,2055],{"class":1420},"dimensionValues",[1381,2057,1400],{"class":1387},[1381,2059,1403],{"class":1387},[1381,2061,1406],{"class":1387},[1381,2063,2064],{"class":1383,"line":1509},[1381,2065,2066],{"class":1387},"        {\n",[1381,2068,2069,2072,2075,2077,2079,2081,2084],{"class":1383,"line":1514},[1381,2070,2071],{"class":1387},"          \"",[1381,2073,2074],{"class":1604},"value",[1381,2076,1400],{"class":1387},[1381,2078,1403],{"class":1387},[1381,2080,1428],{"class":1387},[1381,2082,2083],{"class":1431},"20210104",[1381,2085,1457],{"class":1387},[1381,2087,2088],{"class":1383,"line":1519},[1381,2089,2090],{"class":1387},"        }\n",[1381,2092,2093],{"class":1383,"line":1533},[1381,2094,2095],{"class":1387},"      ],\n",[1381,2097,2098,2100,2103,2105,2107],{"class":1383,"line":1538},[1381,2099,1417],{"class":1387},[1381,2101,2102],{"class":1420},"metricValues",[1381,2104,1400],{"class":1387},[1381,2106,1403],{"class":1387},[1381,2108,1406],{"class":1387},[1381,2110,2111],{"class":1383,"line":1555},[1381,2112,2066],{"class":1387},[1381,2114,2115,2117,2119,2121,2123,2125,2128],{"class":1383,"line":1560},[1381,2116,2071],{"class":1387},[1381,2118,2074],{"class":1604},[1381,2120,1400],{"class":1387},[1381,2122,1403],{"class":1387},[1381,2124,1428],{"class":1387},[1381,2126,2127],{"class":1431},"12900",[1381,2129,1457],{"class":1387},[1381,2131,2132],{"class":1383,"line":1565},[1381,2133,2090],{"class":1387},[1381,2135,2136],{"class":1383,"line":1578},[1381,2137,2138],{"class":1387},"      ]\n",[1381,2140,2141],{"class":1383,"line":1583},[1381,2142,2143],{"class":1387},"    },\n",[1381,2145,2146],{"class":1383,"line":1598},[1381,2147,1411],{"class":1387},[1381,2149,2150,2152,2154,2156,2158],{"class":1383,"line":1618},[1381,2151,1417],{"class":1387},[1381,2153,2055],{"class":1420},[1381,2155,1400],{"class":1387},[1381,2157,1403],{"class":1387},[1381,2159,1406],{"class":1387},[1381,2161,2162],{"class":1383,"line":1624},[1381,2163,2066],{"class":1387},[1381,2165,2166,2168,2170,2172,2174,2176,2179],{"class":1383,"line":1639},[1381,2167,2071],{"class":1387},[1381,2169,2074],{"class":1604},[1381,2171,1400],{"class":1387},[1381,2173,1403],{"class":1387},[1381,2175,1428],{"class":1387},[1381,2177,2178],{"class":1431},"20210105",[1381,2180,1457],{"class":1387},[1381,2182,2183],{"class":1383,"line":1644},[1381,2184,2090],{"class":1387},[1381,2186,2187],{"class":1383,"line":1650},[1381,2188,2095],{"class":1387},[1381,2190,2192,2194,2196,2198,2200],{"class":1383,"line":2191},27,[1381,2193,1417],{"class":1387},[1381,2195,2102],{"class":1420},[1381,2197,1400],{"class":1387},[1381,2199,1403],{"class":1387},[1381,2201,1406],{"class":1387},[1381,2203,2205],{"class":1383,"line":2204},28,[1381,2206,2066],{"class":1387},[1381,2208,2210,2212,2214,2216,2218,2220,2223],{"class":1383,"line":2209},29,[1381,2211,2071],{"class":1387},[1381,2213,2074],{"class":1604},[1381,2215,1400],{"class":1387},[1381,2217,1403],{"class":1387},[1381,2219,1428],{"class":1387},[1381,2221,2222],{"class":1431},"10700",[1381,2224,1457],{"class":1387},[1381,2226,2228],{"class":1383,"line":2227},30,[1381,2229,2090],{"class":1387},[1381,2231,2233],{"class":1383,"line":2232},31,[1381,2234,2138],{"class":1387},[1381,2236,2238],{"class":1383,"line":2237},32,[1381,2239,2143],{"class":1387},[1381,2241,2243],{"class":1383,"line":2242},33,[1381,2244,1411],{"class":1387},[1381,2246,2248,2250,2252,2254,2256],{"class":1383,"line":2247},34,[1381,2249,1417],{"class":1387},[1381,2251,2055],{"class":1420},[1381,2253,1400],{"class":1387},[1381,2255,1403],{"class":1387},[1381,2257,1406],{"class":1387},[1381,2259,2261],{"class":1383,"line":2260},35,[1381,2262,2066],{"class":1387},[1381,2264,2266,2268,2270,2272,2274,2276,2279],{"class":1383,"line":2265},36,[1381,2267,2071],{"class":1387},[1381,2269,2074],{"class":1604},[1381,2271,1400],{"class":1387},[1381,2273,1403],{"class":1387},[1381,2275,1428],{"class":1387},[1381,2277,2278],{"class":1431},"20210106",[1381,2280,1457],{"class":1387},[1381,2282,2284],{"class":1383,"line":2283},37,[1381,2285,2090],{"class":1387},[1381,2287,2289],{"class":1383,"line":2288},38,[1381,2290,2095],{"class":1387},[1381,2292,2294,2296,2298,2300,2302],{"class":1383,"line":2293},39,[1381,2295,1417],{"class":1387},[1381,2297,2102],{"class":1420},[1381,2299,1400],{"class":1387},[1381,2301,1403],{"class":1387},[1381,2303,1406],{"class":1387},[1381,2305,2307],{"class":1383,"line":2306},40,[1381,2308,2066],{"class":1387},[1381,2310,2312,2314,2316,2318,2320,2322,2325],{"class":1383,"line":2311},41,[1381,2313,2071],{"class":1387},[1381,2315,2074],{"class":1604},[1381,2317,1400],{"class":1387},[1381,2319,1403],{"class":1387},[1381,2321,1428],{"class":1387},[1381,2323,2324],{"class":1431},"11300",[1381,2326,1457],{"class":1387},[1381,2328,2330],{"class":1383,"line":2329},42,[1381,2331,2090],{"class":1387},[1381,2333,2335],{"class":1383,"line":2334},43,[1381,2336,2138],{"class":1387},[1381,2338,2340],{"class":1383,"line":2339},44,[1381,2341,1463],{"class":1387},[1381,2343,2345],{"class":1383,"line":2344},45,[1381,2346,1469],{"class":1387},[1381,2348,2350,2352,2355,2357,2359],{"class":1383,"line":2349},46,[1381,2351,1393],{"class":1387},[1381,2353,2354],{"class":1396},"metadata",[1381,2356,1400],{"class":1387},[1381,2358,1403],{"class":1387},[1381,2360,2361],{"class":1387}," {},\n",[1381,2363,2365,2367,2370,2372,2374],{"class":1383,"line":2364},47,[1381,2366,1393],{"class":1387},[1381,2368,2369],{"class":1396},"dimensionHeaders",[1381,2371,1400],{"class":1387},[1381,2373,1403],{"class":1387},[1381,2375,1406],{"class":1387},[1381,2377,2379],{"class":1383,"line":2378},48,[1381,2380,1411],{"class":1387},[1381,2382,2384,2386,2388,2390,2392,2394,2396],{"class":1383,"line":2383},49,[1381,2385,1417],{"class":1387},[1381,2387,1341],{"class":1420},[1381,2389,1400],{"class":1387},[1381,2391,1403],{"class":1387},[1381,2393,1428],{"class":1387},[1381,2395,649],{"class":1431},[1381,2397,1457],{"class":1387},[1381,2399,2401],{"class":1383,"line":2400},50,[1381,2402,1463],{"class":1387},[1381,2404,2406],{"class":1383,"line":2405},51,[1381,2407,1469],{"class":1387},[1381,2409,2411,2413,2416,2418,2420],{"class":1383,"line":2410},52,[1381,2412,1393],{"class":1387},[1381,2414,2415],{"class":1396},"rowCount",[1381,2417,1400],{"class":1387},[1381,2419,1403],{"class":1387},[1381,2421,2422],{"class":1604}," 3\n",[1381,2424,2426],{"class":1383,"line":2425},53,[1381,2427,1653],{"class":1387},[16,2429,2430],{},[1284,2431,2432],{},"The results from UA for comparison:",[1373,2434,2436],{"className":1375,"code":2435,"language":1377,"meta":35,"style":35},"{\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",[80,2437,2438,2442,2456,2478,2491,2506,2526,2543,2548,2553,2557,2561,2574,2586,2607,2619,2642,2647,2652,2659,2679,2691,2711,2715,2719,2725,2745,2757,2777,2781,2785,2790,2795,2808,2829,2833,2837,2852,2865,2885,2889,2893,2906,2926,2930,2935,2939],{"__ignoreMap":35},[1381,2439,2440],{"class":1383,"line":1384},[1381,2441,1388],{"class":1387},[1381,2443,2444,2447,2450,2452,2454],{"class":1383,"line":975},[1381,2445,2446],{"class":1387},"    \"",[1381,2448,2449],{"class":1396},"columnHeader",[1381,2451,1400],{"class":1387},[1381,2453,1403],{"class":1387},[1381,2455,1595],{"class":1387},[1381,2457,2458,2460,2462,2464,2466,2469,2471,2473,2475],{"class":1383,"line":982},[1381,2459,1601],{"class":1387},[1381,2461,1524],{"class":1420},[1381,2463,1400],{"class":1387},[1381,2465,1403],{"class":1387},[1381,2467,2468],{"class":1387}," [",[1381,2470,1400],{"class":1387},[1381,2472,1833],{"class":1431},[1381,2474,1400],{"class":1387},[1381,2476,2477],{"class":1387},"],\n",[1381,2479,2480,2482,2485,2487,2489],{"class":1383,"line":1414},[1381,2481,1601],{"class":1387},[1381,2483,2484],{"class":1420},"metricHeader",[1381,2486,1400],{"class":1387},[1381,2488,1403],{"class":1387},[1381,2490,1595],{"class":1387},[1381,2492,2493,2496,2499,2501,2503],{"class":1383,"line":1440},[1381,2494,2495],{"class":1387},"            \"",[1381,2497,2498],{"class":1604},"metricHeaderEntries",[1381,2500,1400],{"class":1387},[1381,2502,1403],{"class":1387},[1381,2504,2505],{"class":1387}," [{\n",[1381,2507,2508,2511,2514,2516,2518,2520,2522,2524],{"class":1383,"line":1460},[1381,2509,2510],{"class":1387},"                    \"",[1381,2512,1341],{"class":2513},"s-wAU",[1381,2515,1400],{"class":1387},[1381,2517,1403],{"class":1387},[1381,2519,1428],{"class":1387},[1381,2521,1776],{"class":1431},[1381,2523,1400],{"class":1387},[1381,2525,1437],{"class":1387},[1381,2527,2528,2530,2532,2534,2536,2538,2541],{"class":1383,"line":1466},[1381,2529,2510],{"class":1387},[1381,2531,2012],{"class":2513},[1381,2533,1400],{"class":1387},[1381,2535,1403],{"class":1387},[1381,2537,1428],{"class":1387},[1381,2539,2540],{"class":1431},"INTEGER",[1381,2542,1457],{"class":1387},[1381,2544,2545],{"class":1383,"line":1472},[1381,2546,2547],{"class":1387},"                }\n",[1381,2549,2550],{"class":1383,"line":1486},[1381,2551,2552],{"class":1387},"            ]\n",[1381,2554,2555],{"class":1383,"line":1491},[1381,2556,2090],{"class":1387},[1381,2558,2559],{"class":1383,"line":1509},[1381,2560,2143],{"class":1387},[1381,2562,2563,2565,2568,2570,2572],{"class":1383,"line":1514},[1381,2564,2446],{"class":1387},[1381,2566,2567],{"class":1396},"data",[1381,2569,1400],{"class":1387},[1381,2571,1403],{"class":1387},[1381,2573,1595],{"class":1387},[1381,2575,2576,2578,2580,2582,2584],{"class":1383,"line":1519},[1381,2577,1601],{"class":1387},[1381,2579,2038],{"class":1420},[1381,2581,1400],{"class":1387},[1381,2583,1403],{"class":1387},[1381,2585,2505],{"class":1387},[1381,2587,2588,2591,2593,2595,2597,2599,2601,2603,2605],{"class":1383,"line":1533},[1381,2589,2590],{"class":1387},"                \"",[1381,2592,1524],{"class":1604},[1381,2594,1400],{"class":1387},[1381,2596,1403],{"class":1387},[1381,2598,2468],{"class":1387},[1381,2600,1400],{"class":1387},[1381,2602,2083],{"class":1431},[1381,2604,1400],{"class":1387},[1381,2606,2477],{"class":1387},[1381,2608,2609,2611,2613,2615,2617],{"class":1383,"line":1538},[1381,2610,2590],{"class":1387},[1381,2612,1477],{"class":1604},[1381,2614,1400],{"class":1387},[1381,2616,1403],{"class":1387},[1381,2618,2505],{"class":1387},[1381,2620,2621,2624,2627,2629,2631,2633,2635,2637,2639],{"class":1383,"line":1555},[1381,2622,2623],{"class":1387},"                        \"",[1381,2625,2626],{"class":2513},"values",[1381,2628,1400],{"class":1387},[1381,2630,1403],{"class":1387},[1381,2632,2468],{"class":1387},[1381,2634,1400],{"class":1387},[1381,2636,2127],{"class":1431},[1381,2638,1400],{"class":1387},[1381,2640,2641],{"class":1387},"]\n",[1381,2643,2644],{"class":1383,"line":1560},[1381,2645,2646],{"class":1387},"                    }\n",[1381,2648,2649],{"class":1383,"line":1565},[1381,2650,2651],{"class":1387},"                ]\n",[1381,2653,2654,2657],{"class":1383,"line":1578},[1381,2655,2656],{"class":1387},"            },",[1381,2658,1595],{"class":1387},[1381,2660,2661,2663,2665,2667,2669,2671,2673,2675,2677],{"class":1383,"line":1583},[1381,2662,2590],{"class":1387},[1381,2664,1524],{"class":1604},[1381,2666,1400],{"class":1387},[1381,2668,1403],{"class":1387},[1381,2670,2468],{"class":1387},[1381,2672,1400],{"class":1387},[1381,2674,2178],{"class":1431},[1381,2676,1400],{"class":1387},[1381,2678,2477],{"class":1387},[1381,2680,2681,2683,2685,2687,2689],{"class":1383,"line":1598},[1381,2682,2590],{"class":1387},[1381,2684,1477],{"class":1604},[1381,2686,1400],{"class":1387},[1381,2688,1403],{"class":1387},[1381,2690,2505],{"class":1387},[1381,2692,2693,2695,2697,2699,2701,2703,2705,2707,2709],{"class":1383,"line":1618},[1381,2694,2623],{"class":1387},[1381,2696,2626],{"class":2513},[1381,2698,1400],{"class":1387},[1381,2700,1403],{"class":1387},[1381,2702,2468],{"class":1387},[1381,2704,1400],{"class":1387},[1381,2706,2222],{"class":1431},[1381,2708,1400],{"class":1387},[1381,2710,2641],{"class":1387},[1381,2712,2713],{"class":1383,"line":1624},[1381,2714,2646],{"class":1387},[1381,2716,2717],{"class":1383,"line":1639},[1381,2718,2651],{"class":1387},[1381,2720,2721,2723],{"class":1383,"line":1644},[1381,2722,2656],{"class":1387},[1381,2724,1595],{"class":1387},[1381,2726,2727,2729,2731,2733,2735,2737,2739,2741,2743],{"class":1383,"line":1650},[1381,2728,2590],{"class":1387},[1381,2730,1524],{"class":1604},[1381,2732,1400],{"class":1387},[1381,2734,1403],{"class":1387},[1381,2736,2468],{"class":1387},[1381,2738,1400],{"class":1387},[1381,2740,2278],{"class":1431},[1381,2742,1400],{"class":1387},[1381,2744,2477],{"class":1387},[1381,2746,2747,2749,2751,2753,2755],{"class":1383,"line":2191},[1381,2748,2590],{"class":1387},[1381,2750,1477],{"class":1604},[1381,2752,1400],{"class":1387},[1381,2754,1403],{"class":1387},[1381,2756,2505],{"class":1387},[1381,2758,2759,2761,2763,2765,2767,2769,2771,2773,2775],{"class":1383,"line":2204},[1381,2760,2623],{"class":1387},[1381,2762,2626],{"class":2513},[1381,2764,1400],{"class":1387},[1381,2766,1403],{"class":1387},[1381,2768,2468],{"class":1387},[1381,2770,1400],{"class":1387},[1381,2772,2324],{"class":1431},[1381,2774,1400],{"class":1387},[1381,2776,2641],{"class":1387},[1381,2778,2779],{"class":1383,"line":2209},[1381,2780,2646],{"class":1387},[1381,2782,2783],{"class":1383,"line":2227},[1381,2784,2651],{"class":1387},[1381,2786,2787],{"class":1383,"line":2232},[1381,2788,2789],{"class":1387},"            }\n",[1381,2791,2792],{"class":1383,"line":2237},[1381,2793,2794],{"class":1387},"        ],\n",[1381,2796,2797,2799,2802,2804,2806],{"class":1383,"line":2242},[1381,2798,1601],{"class":1387},[1381,2800,2801],{"class":1420},"totals",[1381,2803,1400],{"class":1387},[1381,2805,1403],{"class":1387},[1381,2807,2505],{"class":1387},[1381,2809,2810,2812,2814,2816,2818,2820,2822,2825,2827],{"class":1383,"line":2247},[1381,2811,2590],{"class":1387},[1381,2813,2626],{"class":1604},[1381,2815,1400],{"class":1387},[1381,2817,1403],{"class":1387},[1381,2819,2468],{"class":1387},[1381,2821,1400],{"class":1387},[1381,2823,2824],{"class":1431},"34900",[1381,2826,1400],{"class":1387},[1381,2828,2641],{"class":1387},[1381,2830,2831],{"class":1383,"line":2260},[1381,2832,2789],{"class":1387},[1381,2834,2835],{"class":1383,"line":2265},[1381,2836,2794],{"class":1387},[1381,2838,2839,2841,2843,2845,2847,2850],{"class":1383,"line":2283},[1381,2840,1601],{"class":1387},[1381,2842,2415],{"class":1420},[1381,2844,1400],{"class":1387},[1381,2846,1403],{"class":1387},[1381,2848,2849],{"class":1604}," 3",[1381,2851,1437],{"class":1387},[1381,2853,2854,2856,2859,2861,2863],{"class":1383,"line":2288},[1381,2855,1601],{"class":1387},[1381,2857,2858],{"class":1420},"minimums",[1381,2860,1400],{"class":1387},[1381,2862,1403],{"class":1387},[1381,2864,2505],{"class":1387},[1381,2866,2867,2869,2871,2873,2875,2877,2879,2881,2883],{"class":1383,"line":2293},[1381,2868,2590],{"class":1387},[1381,2870,2626],{"class":1604},[1381,2872,1400],{"class":1387},[1381,2874,1403],{"class":1387},[1381,2876,2468],{"class":1387},[1381,2878,1400],{"class":1387},[1381,2880,2222],{"class":1431},[1381,2882,1400],{"class":1387},[1381,2884,2641],{"class":1387},[1381,2886,2887],{"class":1383,"line":2306},[1381,2888,2789],{"class":1387},[1381,2890,2891],{"class":1383,"line":2311},[1381,2892,2794],{"class":1387},[1381,2894,2895,2897,2900,2902,2904],{"class":1383,"line":2329},[1381,2896,1601],{"class":1387},[1381,2898,2899],{"class":1420},"maximums",[1381,2901,1400],{"class":1387},[1381,2903,1403],{"class":1387},[1381,2905,2505],{"class":1387},[1381,2907,2908,2910,2912,2914,2916,2918,2920,2922,2924],{"class":1383,"line":2334},[1381,2909,2590],{"class":1387},[1381,2911,2626],{"class":1604},[1381,2913,1400],{"class":1387},[1381,2915,1403],{"class":1387},[1381,2917,2468],{"class":1387},[1381,2919,1400],{"class":1387},[1381,2921,2127],{"class":1431},[1381,2923,1400],{"class":1387},[1381,2925,2641],{"class":1387},[1381,2927,2928],{"class":1383,"line":2339},[1381,2929,2789],{"class":1387},[1381,2931,2932],{"class":1383,"line":2344},[1381,2933,2934],{"class":1387},"        ]\n",[1381,2936,2937],{"class":1383,"line":2349},[1381,2938,1463],{"class":1387},[1381,2940,2941],{"class":1383,"line":2364},[1381,2942,1653],{"class":1387},[16,2944,2945],{},"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.",[11,2947,2949],{"id":2948},"further-parameters-in-a-single-query","Further parameters in a single query",[97,2951,2953],{"id":2952},"quotas-report","Quotas report",[16,2955,2956],{},"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.",[16,2958,2959,2960,2963,2964,2967,2968,2971,2972,2975,2976,2979,2980,2983],{},"The quotas information can be received by setting the optional parameter ",[80,2961,2962],{},"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 ",[23,2965,2966],{},"tokens consumed"," by the current query ",[23,2969,2970],{},"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 ",[23,2973,2974],{},"permitted concurrent requests"," and ",[23,2977,2978],{},"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 ",[23,2981,2982],{},"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.",[1373,2985,2987],{"className":1375,"code":2986,"language":1377,"meta":35,"style":35},"        \"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",[80,2988,2989,3004,3017,3033,3047,3052,3065,3079,3092,3096,3109,3122,3126,3139,3151,3155,3168,3181,3185],{"__ignoreMap":35},[1381,2990,2991,2993,2996,2998,3002],{"class":1383,"line":1384},[1381,2992,1601],{"class":1387},[1381,2994,2995],{"class":1431},"propertyQuota",[1381,2997,1400],{"class":1387},[1381,2999,3001],{"class":3000},"s0W1g",": ",[1381,3003,1388],{"class":1387},[1381,3005,3006,3008,3011,3013,3015],{"class":1383,"line":975},[1381,3007,2495],{"class":1387},[1381,3009,3010],{"class":1396},"tokensPerDay",[1381,3012,1400],{"class":1387},[1381,3014,1403],{"class":1387},[1381,3016,1595],{"class":1387},[1381,3018,3019,3021,3024,3026,3028,3031],{"class":1383,"line":982},[1381,3020,2590],{"class":1387},[1381,3022,3023],{"class":1420},"consumed",[1381,3025,1400],{"class":1387},[1381,3027,1403],{"class":1387},[1381,3029,3030],{"class":1604}," 5",[1381,3032,1437],{"class":1387},[1381,3034,3035,3037,3040,3042,3044],{"class":1383,"line":1414},[1381,3036,2590],{"class":1387},[1381,3038,3039],{"class":1420},"remaining",[1381,3041,1400],{"class":1387},[1381,3043,1403],{"class":1387},[1381,3045,3046],{"class":1604}," 24986\n",[1381,3048,3049],{"class":1383,"line":1440},[1381,3050,3051],{"class":1387},"            },\n",[1381,3053,3054,3056,3059,3061,3063],{"class":1383,"line":1460},[1381,3055,2495],{"class":1387},[1381,3057,3058],{"class":1396},"tokensPerHour",[1381,3060,1400],{"class":1387},[1381,3062,1403],{"class":1387},[1381,3064,1595],{"class":1387},[1381,3066,3067,3069,3071,3073,3075,3077],{"class":1383,"line":1466},[1381,3068,2590],{"class":1387},[1381,3070,3023],{"class":1420},[1381,3072,1400],{"class":1387},[1381,3074,1403],{"class":1387},[1381,3076,3030],{"class":1604},[1381,3078,1437],{"class":1387},[1381,3080,3081,3083,3085,3087,3089],{"class":1383,"line":1472},[1381,3082,2590],{"class":1387},[1381,3084,3039],{"class":1420},[1381,3086,1400],{"class":1387},[1381,3088,1403],{"class":1387},[1381,3090,3091],{"class":1604}," 4990\n",[1381,3093,3094],{"class":1383,"line":1486},[1381,3095,3051],{"class":1387},[1381,3097,3098,3100,3103,3105,3107],{"class":1383,"line":1491},[1381,3099,2495],{"class":1387},[1381,3101,3102],{"class":1396},"concurrentRequests",[1381,3104,1400],{"class":1387},[1381,3106,1403],{"class":1387},[1381,3108,1595],{"class":1387},[1381,3110,3111,3113,3115,3117,3119],{"class":1383,"line":1509},[1381,3112,2590],{"class":1387},[1381,3114,3039],{"class":1420},[1381,3116,1400],{"class":1387},[1381,3118,1403],{"class":1387},[1381,3120,3121],{"class":1604}," 10\n",[1381,3123,3124],{"class":1383,"line":1514},[1381,3125,3051],{"class":1387},[1381,3127,3128,3130,3133,3135,3137],{"class":1383,"line":1519},[1381,3129,2495],{"class":1387},[1381,3131,3132],{"class":1396},"serverErrorsPerProjectPerHour",[1381,3134,1400],{"class":1387},[1381,3136,1403],{"class":1387},[1381,3138,1595],{"class":1387},[1381,3140,3141,3143,3145,3147,3149],{"class":1383,"line":1533},[1381,3142,2590],{"class":1387},[1381,3144,3039],{"class":1420},[1381,3146,1400],{"class":1387},[1381,3148,1403],{"class":1387},[1381,3150,3121],{"class":1604},[1381,3152,3153],{"class":1383,"line":1538},[1381,3154,3051],{"class":1387},[1381,3156,3157,3159,3162,3164,3166],{"class":1383,"line":1555},[1381,3158,2495],{"class":1387},[1381,3160,3161],{"class":1396},"potentiallyThresholdedRequestsPerHour",[1381,3163,1400],{"class":1387},[1381,3165,1403],{"class":1387},[1381,3167,1595],{"class":1387},[1381,3169,3170,3172,3174,3176,3178],{"class":1383,"line":1560},[1381,3171,2590],{"class":1387},[1381,3173,3039],{"class":1420},[1381,3175,1400],{"class":1387},[1381,3177,1403],{"class":1387},[1381,3179,3180],{"class":1604}," 120\n",[1381,3182,3183],{"class":1383,"line":1565},[1381,3184,2789],{"class":1387},[1381,3186,3187],{"class":1383,"line":1578},[1381,3188,2090],{"class":1387},[97,3190,3192],{"id":3191},"notes-on-filters","Notes on filters",[16,3194,3195,3196,3199],{},"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 ",[80,3197,3198],{},"filtersExpression"," parameter that would allow simple filters to be written in one line.",[16,3201,3202,3203,3206,3207,3210,3211,524,3214,2975,3217,3220],{},"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 ",[80,3204,3205],{},"and"," operator) or that it is sufficient for only one of the filters to be satisfied (using the ",[80,3208,3209],{},"or"," operator). In the GA4 API, there is an option to chain several of these operators using a set of the following parameters successively: ",[80,3212,3213],{},"andGroup",[80,3215,3216],{},"orGroup",[80,3218,3219],{},"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.",[16,3222,3223],{},"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:",[138,3225,3226,3228,3230,3231,3233,3236,3238,3239,3241,3244],{},[23,3227,142],{},[144,3229],{},"\n\n\nEITHER\n",[144,3232],{},[80,3234,3235],{},"(deviceCategory == \"Mobile\" AND pagePath == \"\u002Fpath-to-page\")",[144,3237],{},"\n\n\nOR\n",[144,3240],{},[80,3242,3243],{},"(deviceCategory == \"Tablet\" AND pagePath == \"\u002Fpath-to-another-page\")",[144,3245],{},[1373,3247,3249],{"className":1375,"code":3248,"language":1377,"meta":35,"style":35},"{\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",[80,3250,3251,3255,3268,3280,3293,3298,3310,3324,3329,3344,3358,3376,3381,3398,3403,3408,3412,3424,3436,3453,3457,3474,3478,3482,3487,3491,3499,3503,3515,3527,3531,3543,3555,3572,3576,3592,3596,3600,3604,3616,3628,3645,3649,3665,3669,3673,3677,3681,3686,3690,3695,3699],{"__ignoreMap":35},[1381,3252,3253],{"class":1383,"line":1384},[1381,3254,1388],{"class":1387},[1381,3256,3257,3259,3262,3264,3266],{"class":1383,"line":975},[1381,3258,2446],{"class":1387},[1381,3260,3261],{"class":1396},"dimensionFilter",[1381,3263,1400],{"class":1387},[1381,3265,1403],{"class":1387},[1381,3267,1595],{"class":1387},[1381,3269,3270,3272,3274,3276,3278],{"class":1383,"line":982},[1381,3271,1417],{"class":1387},[1381,3273,3216],{"class":1420},[1381,3275,1400],{"class":1387},[1381,3277,1403],{"class":1387},[1381,3279,1595],{"class":1387},[1381,3281,3282,3284,3287,3289,3291],{"class":1383,"line":1414},[1381,3283,1601],{"class":1387},[1381,3285,3286],{"class":1604},"expressions",[1381,3288,1400],{"class":1387},[1381,3290,1403],{"class":1387},[1381,3292,1406],{"class":1387},[1381,3294,3295],{"class":1383,"line":1440},[1381,3296,3297],{"class":1387},"          {\n",[1381,3299,3300,3302,3304,3306,3308],{"class":1383,"line":1460},[1381,3301,2495],{"class":1387},[1381,3303,3213],{"class":2513},[1381,3305,1400],{"class":1387},[1381,3307,1403],{"class":1387},[1381,3309,1595],{"class":1387},[1381,3311,3312,3315,3318,3320,3322],{"class":1383,"line":1466},[1381,3313,3314],{"class":1387},"              \"",[1381,3316,3286],{"class":3317},"s9WhI",[1381,3319,1400],{"class":1387},[1381,3321,1403],{"class":1387},[1381,3323,1406],{"class":1387},[1381,3325,3326],{"class":1383,"line":1472},[1381,3327,3328],{"class":1387},"                {\n",[1381,3330,3331,3334,3338,3340,3342],{"class":1383,"line":1486},[1381,3332,3333],{"class":1387},"                  \"",[1381,3335,3337],{"class":3336},"sdLwU","filter",[1381,3339,1400],{"class":1387},[1381,3341,1403],{"class":1387},[1381,3343,1595],{"class":1387},[1381,3345,3346,3348,3352,3354,3356],{"class":1383,"line":1491},[1381,3347,2510],{"class":1387},[1381,3349,3351],{"class":3350},"sbqyR","stringFilter",[1381,3353,1400],{"class":1387},[1381,3355,1403],{"class":1387},[1381,3357,1595],{"class":1387},[1381,3359,3360,3363,3365,3367,3369,3371,3374],{"class":1383,"line":1509},[1381,3361,3362],{"class":1387},"                      \"",[1381,3364,2074],{"class":1396},[1381,3366,1400],{"class":1387},[1381,3368,1403],{"class":1387},[1381,3370,1428],{"class":1387},[1381,3372,3373],{"class":1431},"Mobile",[1381,3375,1457],{"class":1387},[1381,3377,3378],{"class":1383,"line":1514},[1381,3379,3380],{"class":1387},"                    },\n",[1381,3382,3383,3385,3387,3389,3391,3393,3396],{"class":1383,"line":1519},[1381,3384,2510],{"class":1387},[1381,3386,1886],{"class":3350},[1381,3388,1400],{"class":1387},[1381,3390,1403],{"class":1387},[1381,3392,1428],{"class":1387},[1381,3394,3395],{"class":1431},"deviceCategory",[1381,3397,1457],{"class":1387},[1381,3399,3400],{"class":1383,"line":1533},[1381,3401,3402],{"class":1387},"                  }\n",[1381,3404,3405],{"class":1383,"line":1538},[1381,3406,3407],{"class":1387},"                },\n",[1381,3409,3410],{"class":1383,"line":1555},[1381,3411,3328],{"class":1387},[1381,3413,3414,3416,3418,3420,3422],{"class":1383,"line":1560},[1381,3415,3333],{"class":1387},[1381,3417,3337],{"class":3336},[1381,3419,1400],{"class":1387},[1381,3421,1403],{"class":1387},[1381,3423,1595],{"class":1387},[1381,3425,3426,3428,3430,3432,3434],{"class":1383,"line":1565},[1381,3427,2510],{"class":1387},[1381,3429,3351],{"class":3350},[1381,3431,1400],{"class":1387},[1381,3433,1403],{"class":1387},[1381,3435,1595],{"class":1387},[1381,3437,3438,3440,3442,3444,3446,3448,3451],{"class":1383,"line":1578},[1381,3439,3362],{"class":1387},[1381,3441,2074],{"class":1396},[1381,3443,1400],{"class":1387},[1381,3445,1403],{"class":1387},[1381,3447,1428],{"class":1387},[1381,3449,3450],{"class":1431},"\u002Fpath-to-page",[1381,3452,1457],{"class":1387},[1381,3454,3455],{"class":1383,"line":1583},[1381,3456,3380],{"class":1387},[1381,3458,3459,3461,3463,3465,3467,3469,3472],{"class":1383,"line":1598},[1381,3460,2510],{"class":1387},[1381,3462,1886],{"class":3350},[1381,3464,1400],{"class":1387},[1381,3466,1403],{"class":1387},[1381,3468,1428],{"class":1387},[1381,3470,3471],{"class":1431},"pagePath",[1381,3473,1457],{"class":1387},[1381,3475,3476],{"class":1383,"line":1618},[1381,3477,3402],{"class":1387},[1381,3479,3480],{"class":1383,"line":1624},[1381,3481,2547],{"class":1387},[1381,3483,3484],{"class":1383,"line":1639},[1381,3485,3486],{"class":1387},"              ]\n",[1381,3488,3489],{"class":1383,"line":1644},[1381,3490,2789],{"class":1387},[1381,3492,3493,3496],{"class":1383,"line":1650},[1381,3494,3495],{"class":1387},"          },",[1381,3497,3498],{"class":3000}," \n",[1381,3500,3501],{"class":1383,"line":2191},[1381,3502,2066],{"class":1387},[1381,3504,3505,3507,3509,3511,3513],{"class":1383,"line":2204},[1381,3506,2495],{"class":1387},[1381,3508,3213],{"class":2513},[1381,3510,1400],{"class":1387},[1381,3512,1403],{"class":1387},[1381,3514,1595],{"class":1387},[1381,3516,3517,3519,3521,3523,3525],{"class":1383,"line":2209},[1381,3518,3314],{"class":1387},[1381,3520,3286],{"class":3317},[1381,3522,1400],{"class":1387},[1381,3524,1403],{"class":1387},[1381,3526,1406],{"class":1387},[1381,3528,3529],{"class":1383,"line":2227},[1381,3530,3328],{"class":1387},[1381,3532,3533,3535,3537,3539,3541],{"class":1383,"line":2232},[1381,3534,3333],{"class":1387},[1381,3536,3337],{"class":3336},[1381,3538,1400],{"class":1387},[1381,3540,1403],{"class":1387},[1381,3542,1595],{"class":1387},[1381,3544,3545,3547,3549,3551,3553],{"class":1383,"line":2237},[1381,3546,2510],{"class":1387},[1381,3548,3351],{"class":3350},[1381,3550,1400],{"class":1387},[1381,3552,1403],{"class":1387},[1381,3554,1595],{"class":1387},[1381,3556,3557,3559,3561,3563,3565,3567,3570],{"class":1383,"line":2242},[1381,3558,3362],{"class":1387},[1381,3560,2074],{"class":1396},[1381,3562,1400],{"class":1387},[1381,3564,1403],{"class":1387},[1381,3566,1428],{"class":1387},[1381,3568,3569],{"class":1431},"Tablet",[1381,3571,1457],{"class":1387},[1381,3573,3574],{"class":1383,"line":2247},[1381,3575,3380],{"class":1387},[1381,3577,3578,3580,3582,3584,3586,3588,3590],{"class":1383,"line":2260},[1381,3579,2510],{"class":1387},[1381,3581,1886],{"class":3350},[1381,3583,1400],{"class":1387},[1381,3585,1403],{"class":1387},[1381,3587,1428],{"class":1387},[1381,3589,3395],{"class":1431},[1381,3591,1457],{"class":1387},[1381,3593,3594],{"class":1383,"line":2265},[1381,3595,3402],{"class":1387},[1381,3597,3598],{"class":1383,"line":2283},[1381,3599,3407],{"class":1387},[1381,3601,3602],{"class":1383,"line":2288},[1381,3603,3328],{"class":1387},[1381,3605,3606,3608,3610,3612,3614],{"class":1383,"line":2293},[1381,3607,3333],{"class":1387},[1381,3609,3337],{"class":3336},[1381,3611,1400],{"class":1387},[1381,3613,1403],{"class":1387},[1381,3615,1595],{"class":1387},[1381,3617,3618,3620,3622,3624,3626],{"class":1383,"line":2306},[1381,3619,2510],{"class":1387},[1381,3621,3351],{"class":3350},[1381,3623,1400],{"class":1387},[1381,3625,1403],{"class":1387},[1381,3627,1595],{"class":1387},[1381,3629,3630,3632,3634,3636,3638,3640,3643],{"class":1383,"line":2311},[1381,3631,3362],{"class":1387},[1381,3633,2074],{"class":1396},[1381,3635,1400],{"class":1387},[1381,3637,1403],{"class":1387},[1381,3639,1428],{"class":1387},[1381,3641,3642],{"class":1431},"\u002Fpath-to-different-page",[1381,3644,1457],{"class":1387},[1381,3646,3647],{"class":1383,"line":2329},[1381,3648,3380],{"class":1387},[1381,3650,3651,3653,3655,3657,3659,3661,3663],{"class":1383,"line":2334},[1381,3652,2510],{"class":1387},[1381,3654,1886],{"class":3350},[1381,3656,1400],{"class":1387},[1381,3658,1403],{"class":1387},[1381,3660,1428],{"class":1387},[1381,3662,3471],{"class":1431},[1381,3664,1457],{"class":1387},[1381,3666,3667],{"class":1383,"line":2339},[1381,3668,3402],{"class":1387},[1381,3670,3671],{"class":1383,"line":2344},[1381,3672,2547],{"class":1387},[1381,3674,3675],{"class":1383,"line":2349},[1381,3676,3486],{"class":1387},[1381,3678,3679],{"class":1383,"line":2364},[1381,3680,2789],{"class":1387},[1381,3682,3683],{"class":1383,"line":2378},[1381,3684,3685],{"class":1387},"          }\n",[1381,3687,3688],{"class":1383,"line":2383},[1381,3689,2934],{"class":1387},[1381,3691,3692],{"class":1383,"line":2400},[1381,3693,3694],{"class":1387},"      }\n",[1381,3696,3697],{"class":1383,"line":2405},[1381,3698,1463],{"class":1387},[1381,3700,3701],{"class":1383,"line":2410},[1381,3702,3703],{"class":1387},"  }\n",[16,3705,3706,3707,524,3710,524,3712,524,3715,2975,3718,3721,3722,2975,3724,3726,3727,3729,3730,3732],{},"For the individual dimension or metric filter there are several options for filter types: ",[80,3708,3709],{},"nullFilter",[80,3711,3351],{},[80,3713,3714],{},"inListFilter",[80,3716,3717],{},"numericFilter",[80,3719,3720],{},"betweenFilter",". While these are not entirely innovative, they present a more systematic way of selecting the type by separating ",[80,3723,3714],{},[80,3725,3720],{}," from the classical numeric and string filters. The ",[80,3728,3709],{}," offers an option to check for null values in a dimension. It can be accompanied by ",[80,3731,3219],{}," to exclude all rows with null values in a certain dimension.",[97,3734,3736],{"id":3735},"cohorts","Cohorts",[16,3738,3739,3740,3744,3745,3748,3749,3751],{},"Cohorts were possible to analyze already in the original API. To learn more about that, check our article on extended options in the ",[949,3741,3743],{"href":1275,"rel":3742},[953],"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 ",[80,3746,3747],{},"firstTouchDate",". You further specify a name to denote the cohort group and the date range for the ",[80,3750,3747],{}," that defines the cohort.",[16,3753,3754],{},"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.",[16,3756,3757],{},"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.",[16,3759,3760],{},[33,3761],{"alt":35,"src":3762,"title":3763},"\u002Fupload\u002Fcohort.webp","Cohort Comparison",[1373,3765,3767],{"className":1375,"code":3766,"language":1377,"meta":35,"style":35},"    {\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",[80,3768,3769,3773,3785,3790,3807,3811,3815,3832,3836,3840,3852,3856,3875,3892,3896,3900,3913,3925,3929,3948,3967,3980,3999,4016,4020,4024,4028,4047,4065,4077,4096,4113,4117,4121,4125,4144,4162,4174,4193,4210,4214,4218,4223,4236,4256,4272,4286,4290,4294],{"__ignoreMap":35},[1381,3770,3771],{"class":1383,"line":1384},[1381,3772,1411],{"class":1387},[1381,3774,3775,3777,3779,3781,3783],{"class":1383,"line":975},[1381,3776,1601],{"class":1387},[1381,3778,1524],{"class":1396},[1381,3780,1400],{"class":1387},[1381,3782,1403],{"class":1387},[1381,3784,1406],{"class":1387},[1381,3786,3787],{"class":1383,"line":982},[1381,3788,3789],{"class":1387},"            {\n",[1381,3791,3792,3794,3796,3798,3800,3802,3805],{"class":1383,"line":1414},[1381,3793,2590],{"class":1387},[1381,3795,1341],{"class":1420},[1381,3797,1400],{"class":1387},[1381,3799,1403],{"class":1387},[1381,3801,1428],{"class":1387},[1381,3803,3804],{"class":1431},"cohort",[1381,3806,1457],{"class":1387},[1381,3808,3809],{"class":1383,"line":1440},[1381,3810,3051],{"class":1387},[1381,3812,3813],{"class":1383,"line":1460},[1381,3814,3789],{"class":1387},[1381,3816,3817,3819,3821,3823,3825,3827,3830],{"class":1383,"line":1466},[1381,3818,2590],{"class":1387},[1381,3820,1341],{"class":1420},[1381,3822,1400],{"class":1387},[1381,3824,1403],{"class":1387},[1381,3826,1428],{"class":1387},[1381,3828,3829],{"class":1431},"cohortNthWeek",[1381,3831,1457],{"class":1387},[1381,3833,3834],{"class":1383,"line":1472},[1381,3835,2789],{"class":1387},[1381,3837,3838],{"class":1383,"line":1486},[1381,3839,2794],{"class":1387},[1381,3841,3842,3844,3846,3848,3850],{"class":1383,"line":1491},[1381,3843,1601],{"class":1387},[1381,3845,1477],{"class":1396},[1381,3847,1400],{"class":1387},[1381,3849,1403],{"class":1387},[1381,3851,1406],{"class":1387},[1381,3853,3854],{"class":1383,"line":1509},[1381,3855,2066],{"class":1387},[1381,3857,3858,3860,3862,3864,3866,3868,3871,3873],{"class":1383,"line":1514},[1381,3859,2071],{"class":1387},[1381,3861,1341],{"class":1420},[1381,3863,1400],{"class":1387},[1381,3865,1403],{"class":1387},[1381,3867,1428],{"class":1387},[1381,3869,3870],{"class":1431},"cohortRetentionFraction",[1381,3872,1400],{"class":1387},[1381,3874,1437],{"class":1387},[1381,3876,3877,3879,3881,3883,3885,3887,3890],{"class":1383,"line":1519},[1381,3878,2071],{"class":1387},[1381,3880,1345],{"class":1420},[1381,3882,1400],{"class":1387},[1381,3884,1403],{"class":1387},[1381,3886,1428],{"class":1387},[1381,3888,3889],{"class":1431},"cohortActiveUsers\u002FcohortTotalUsers",[1381,3891,1457],{"class":1387},[1381,3893,3894],{"class":1383,"line":1533},[1381,3895,2090],{"class":1387},[1381,3897,3898],{"class":1383,"line":1538},[1381,3899,2095],{"class":1387},[1381,3901,3902,3904,3907,3909,3911],{"class":1383,"line":1555},[1381,3903,1601],{"class":1387},[1381,3905,3906],{"class":1396},"cohortSpec",[1381,3908,1400],{"class":1387},[1381,3910,1403],{"class":1387},[1381,3912,1595],{"class":1387},[1381,3914,3915,3917,3919,3921,3923],{"class":1383,"line":1560},[1381,3916,2495],{"class":1387},[1381,3918,3735],{"class":1420},[1381,3920,1400],{"class":1387},[1381,3922,1403],{"class":1387},[1381,3924,1406],{"class":1387},[1381,3926,3927],{"class":1383,"line":1565},[1381,3928,3328],{"class":1387},[1381,3930,3931,3933,3935,3937,3939,3941,3944,3946],{"class":1383,"line":1578},[1381,3932,2510],{"class":1387},[1381,3934,1341],{"class":1604},[1381,3936,1400],{"class":1387},[1381,3938,1403],{"class":1387},[1381,3940,1428],{"class":1387},[1381,3942,3943],{"class":1431},"20-10-02",[1381,3945,1400],{"class":1387},[1381,3947,1437],{"class":1387},[1381,3949,3950,3952,3955,3957,3959,3961,3963,3965],{"class":1383,"line":1583},[1381,3951,2510],{"class":1387},[1381,3953,3954],{"class":1604},"dimension",[1381,3956,1400],{"class":1387},[1381,3958,1403],{"class":1387},[1381,3960,1428],{"class":1387},[1381,3962,3747],{"class":1431},[1381,3964,1400],{"class":1387},[1381,3966,1437],{"class":1387},[1381,3968,3969,3971,3974,3976,3978],{"class":1383,"line":1598},[1381,3970,2510],{"class":1387},[1381,3972,3973],{"class":1604},"dateRange",[1381,3975,1400],{"class":1387},[1381,3977,1403],{"class":1387},[1381,3979,1595],{"class":1387},[1381,3981,3982,3984,3986,3988,3990,3992,3995,3997],{"class":1383,"line":1618},[1381,3983,2623],{"class":1387},[1381,3985,1421],{"class":2513},[1381,3987,1400],{"class":1387},[1381,3989,1403],{"class":1387},[1381,3991,1428],{"class":1387},[1381,3993,3994],{"class":1431},"2020-10-05",[1381,3996,1400],{"class":1387},[1381,3998,1437],{"class":1387},[1381,4000,4001,4003,4005,4007,4009,4011,4014],{"class":1383,"line":1624},[1381,4002,2623],{"class":1387},[1381,4004,1445],{"class":2513},[1381,4006,1400],{"class":1387},[1381,4008,1403],{"class":1387},[1381,4010,1428],{"class":1387},[1381,4012,4013],{"class":1431},"2020-10-11",[1381,4015,1457],{"class":1387},[1381,4017,4018],{"class":1383,"line":1639},[1381,4019,2646],{"class":1387},[1381,4021,4022],{"class":1383,"line":1644},[1381,4023,3407],{"class":1387},[1381,4025,4026],{"class":1383,"line":1650},[1381,4027,3328],{"class":1387},[1381,4029,4030,4032,4034,4036,4038,4040,4043,4045],{"class":1383,"line":2191},[1381,4031,2510],{"class":1387},[1381,4033,1341],{"class":1604},[1381,4035,1400],{"class":1387},[1381,4037,1403],{"class":1387},[1381,4039,1428],{"class":1387},[1381,4041,4042],{"class":1431},"20-11-02",[1381,4044,1400],{"class":1387},[1381,4046,1437],{"class":1387},[1381,4048,4049,4051,4053,4055,4057,4059,4061,4063],{"class":1383,"line":2204},[1381,4050,2510],{"class":1387},[1381,4052,3954],{"class":1604},[1381,4054,1400],{"class":1387},[1381,4056,1403],{"class":1387},[1381,4058,1428],{"class":1387},[1381,4060,3747],{"class":1431},[1381,4062,1400],{"class":1387},[1381,4064,1437],{"class":1387},[1381,4066,4067,4069,4071,4073,4075],{"class":1383,"line":2209},[1381,4068,2510],{"class":1387},[1381,4070,3973],{"class":1604},[1381,4072,1400],{"class":1387},[1381,4074,1403],{"class":1387},[1381,4076,1595],{"class":1387},[1381,4078,4079,4081,4083,4085,4087,4089,4092,4094],{"class":1383,"line":2227},[1381,4080,2623],{"class":1387},[1381,4082,1421],{"class":2513},[1381,4084,1400],{"class":1387},[1381,4086,1403],{"class":1387},[1381,4088,1428],{"class":1387},[1381,4090,4091],{"class":1431},"2020-11-09",[1381,4093,1400],{"class":1387},[1381,4095,1437],{"class":1387},[1381,4097,4098,4100,4102,4104,4106,4108,4111],{"class":1383,"line":2232},[1381,4099,2623],{"class":1387},[1381,4101,1445],{"class":2513},[1381,4103,1400],{"class":1387},[1381,4105,1403],{"class":1387},[1381,4107,1428],{"class":1387},[1381,4109,4110],{"class":1431},"2020-11-15",[1381,4112,1457],{"class":1387},[1381,4114,4115],{"class":1383,"line":2237},[1381,4116,2646],{"class":1387},[1381,4118,4119],{"class":1383,"line":2242},[1381,4120,3407],{"class":1387},[1381,4122,4123],{"class":1383,"line":2247},[1381,4124,3328],{"class":1387},[1381,4126,4127,4129,4131,4133,4135,4137,4140,4142],{"class":1383,"line":2260},[1381,4128,2510],{"class":1387},[1381,4130,1341],{"class":1604},[1381,4132,1400],{"class":1387},[1381,4134,1403],{"class":1387},[1381,4136,1428],{"class":1387},[1381,4138,4139],{"class":1431},"20-12-02",[1381,4141,1400],{"class":1387},[1381,4143,1437],{"class":1387},[1381,4145,4146,4148,4150,4152,4154,4156,4158,4160],{"class":1383,"line":2265},[1381,4147,2510],{"class":1387},[1381,4149,3954],{"class":1604},[1381,4151,1400],{"class":1387},[1381,4153,1403],{"class":1387},[1381,4155,1428],{"class":1387},[1381,4157,3747],{"class":1431},[1381,4159,1400],{"class":1387},[1381,4161,1437],{"class":1387},[1381,4163,4164,4166,4168,4170,4172],{"class":1383,"line":2283},[1381,4165,2510],{"class":1387},[1381,4167,3973],{"class":1604},[1381,4169,1400],{"class":1387},[1381,4171,1403],{"class":1387},[1381,4173,1595],{"class":1387},[1381,4175,4176,4178,4180,4182,4184,4186,4189,4191],{"class":1383,"line":2288},[1381,4177,2623],{"class":1387},[1381,4179,1421],{"class":2513},[1381,4181,1400],{"class":1387},[1381,4183,1403],{"class":1387},[1381,4185,1428],{"class":1387},[1381,4187,4188],{"class":1431},"2020-12-08",[1381,4190,1400],{"class":1387},[1381,4192,1437],{"class":1387},[1381,4194,4195,4197,4199,4201,4203,4205,4208],{"class":1383,"line":2293},[1381,4196,2623],{"class":1387},[1381,4198,1445],{"class":2513},[1381,4200,1400],{"class":1387},[1381,4202,1403],{"class":1387},[1381,4204,1428],{"class":1387},[1381,4206,4207],{"class":1431},"2020-12-14",[1381,4209,1457],{"class":1387},[1381,4211,4212],{"class":1383,"line":2306},[1381,4213,2646],{"class":1387},[1381,4215,4216],{"class":1383,"line":2311},[1381,4217,2547],{"class":1387},[1381,4219,4220],{"class":1383,"line":2329},[1381,4221,4222],{"class":1387},"            ],\n",[1381,4224,4225,4227,4230,4232,4234],{"class":1383,"line":2334},[1381,4226,2495],{"class":1387},[1381,4228,4229],{"class":1420},"cohortsRange",[1381,4231,1400],{"class":1387},[1381,4233,1403],{"class":1387},[1381,4235,1595],{"class":1387},[1381,4237,4238,4240,4243,4245,4247,4249,4252,4254],{"class":1383,"line":2339},[1381,4239,2590],{"class":1387},[1381,4241,4242],{"class":1604},"granularity",[1381,4244,1400],{"class":1387},[1381,4246,1403],{"class":1387},[1381,4248,1428],{"class":1387},[1381,4250,4251],{"class":1431},"WEEKLY",[1381,4253,1400],{"class":1387},[1381,4255,1437],{"class":1387},[1381,4257,4258,4260,4263,4265,4267,4270],{"class":1383,"line":2344},[1381,4259,2590],{"class":1387},[1381,4261,4262],{"class":1604},"startOffset",[1381,4264,1400],{"class":1387},[1381,4266,1403],{"class":1387},[1381,4268,4269],{"class":1604}," 0",[1381,4271,1437],{"class":1387},[1381,4273,4274,4276,4279,4281,4283],{"class":1383,"line":2349},[1381,4275,2590],{"class":1387},[1381,4277,4278],{"class":1604},"endOffset",[1381,4280,1400],{"class":1387},[1381,4282,1403],{"class":1387},[1381,4284,4285],{"class":1604}," 4\n",[1381,4287,4288],{"class":1383,"line":2364},[1381,4289,2789],{"class":1387},[1381,4291,4292],{"class":1383,"line":2378},[1381,4293,2090],{"class":1387},[1381,4295,4296],{"class":1383,"line":2383},[1381,4297,1463],{"class":1387},[16,4299,4300,4301,4306],{},"For more examples, ",[949,4302,4305],{"href":4303,"rel":4304},"https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fdevguides\u002Freporting\u002Fdata\u002Fv1\u002Fadvanced#cohort_report_examples",[953],"Google provides"," sample queries with explanations and visual representation.",[97,4308,4310],{"id":4309},"pagination","Pagination",[16,4312,4313,4314,4317,4318,4321,4322,4324],{},"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 ",[80,4315,4316],{},"limit"," parameter with the parameter ",[80,4319,4320],{},"offset"," which specifies from which index the results should be displayed. Therefore, if the ",[80,4323,2415],{}," 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:",[16,4326,4327],{},[80,4328,4329],{},"{… \"limit\": 10000, \"offset\": 0}",[16,4331,4332],{},"and next, with offset set to 10,000 to query rows starting with the row index 10,001:",[16,4334,4335],{},[80,4336,4337],{},"{… \"limit\": 10000, \"offset\": 10000}",[11,4339,4341],{"id":4340},"multiple-queries","Multiple queries",[16,4343,4344,4345,4348,4349,4351],{},"To run multiple requests together, you need to use the ",[23,4346,4347],{},"batchRunReports"," method instead of the ",[23,4350,1310],{}," 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.",[16,4353,4354],{},"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.",[1373,4356,4358],{"className":1375,"code":4357,"language":1377,"meta":35,"style":35},"{\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",[80,4359,4360,4364,4377,4381,4393,4397,4415,4431,4435,4439,4451,4455,4471,4475,4479,4491,4495,4511,4515,4519,4531,4535,4547,4563,4567,4579,4583,4587,4592,4596,4608,4612,4631,4648,4652,4656,4668,4672,4688,4692,4696,4700,4705],{"__ignoreMap":35},[1381,4361,4362],{"class":1383,"line":1384},[1381,4363,1388],{"class":1387},[1381,4365,4366,4368,4371,4373,4375],{"class":1383,"line":975},[1381,4367,2446],{"class":1387},[1381,4369,4370],{"class":1396},"requests",[1381,4372,1400],{"class":1387},[1381,4374,1403],{"class":1387},[1381,4376,1406],{"class":1387},[1381,4378,4379],{"class":1383,"line":982},[1381,4380,2066],{"class":1387},[1381,4382,4383,4385,4387,4389,4391],{"class":1383,"line":1414},[1381,4384,2495],{"class":1387},[1381,4386,1397],{"class":1420},[1381,4388,1400],{"class":1387},[1381,4390,1403],{"class":1387},[1381,4392,1406],{"class":1387},[1381,4394,4395],{"class":1383,"line":1440},[1381,4396,3328],{"class":1387},[1381,4398,4399,4401,4403,4405,4407,4409,4411,4413],{"class":1383,"line":1460},[1381,4400,2510],{"class":1387},[1381,4402,1421],{"class":1604},[1381,4404,1400],{"class":1387},[1381,4406,1403],{"class":1387},[1381,4408,1428],{"class":1387},[1381,4410,1432],{"class":1431},[1381,4412,1400],{"class":1387},[1381,4414,1437],{"class":1387},[1381,4416,4417,4419,4421,4423,4425,4427,4429],{"class":1383,"line":1466},[1381,4418,2510],{"class":1387},[1381,4420,1445],{"class":1604},[1381,4422,1400],{"class":1387},[1381,4424,1403],{"class":1387},[1381,4426,1428],{"class":1387},[1381,4428,1454],{"class":1431},[1381,4430,1457],{"class":1387},[1381,4432,4433],{"class":1383,"line":1472},[1381,4434,2547],{"class":1387},[1381,4436,4437],{"class":1383,"line":1486},[1381,4438,4222],{"class":1387},[1381,4440,4441,4443,4445,4447,4449],{"class":1383,"line":1491},[1381,4442,2495],{"class":1387},[1381,4444,1477],{"class":1420},[1381,4446,1400],{"class":1387},[1381,4448,1403],{"class":1387},[1381,4450,1406],{"class":1387},[1381,4452,4453],{"class":1383,"line":1509},[1381,4454,3328],{"class":1387},[1381,4456,4457,4459,4461,4463,4465,4467,4469],{"class":1383,"line":1514},[1381,4458,2510],{"class":1387},[1381,4460,1341],{"class":1604},[1381,4462,1400],{"class":1387},[1381,4464,1403],{"class":1387},[1381,4466,1428],{"class":1387},[1381,4468,1504],{"class":1431},[1381,4470,1457],{"class":1387},[1381,4472,4473],{"class":1383,"line":1519},[1381,4474,2547],{"class":1387},[1381,4476,4477],{"class":1383,"line":1533},[1381,4478,4222],{"class":1387},[1381,4480,4481,4483,4485,4487,4489],{"class":1383,"line":1538},[1381,4482,2495],{"class":1387},[1381,4484,1524],{"class":1420},[1381,4486,1400],{"class":1387},[1381,4488,1403],{"class":1387},[1381,4490,1406],{"class":1387},[1381,4492,4493],{"class":1383,"line":1555},[1381,4494,3328],{"class":1387},[1381,4496,4497,4499,4501,4503,4505,4507,4509],{"class":1383,"line":1560},[1381,4498,2510],{"class":1387},[1381,4500,1341],{"class":1604},[1381,4502,1400],{"class":1387},[1381,4504,1403],{"class":1387},[1381,4506,1428],{"class":1387},[1381,4508,649],{"class":1431},[1381,4510,1457],{"class":1387},[1381,4512,4513],{"class":1383,"line":1565},[1381,4514,2547],{"class":1387},[1381,4516,4517],{"class":1383,"line":1578},[1381,4518,4222],{"class":1387},[1381,4520,4521,4523,4525,4527,4529],{"class":1383,"line":1583},[1381,4522,2495],{"class":1387},[1381,4524,1355],{"class":1420},[1381,4526,1400],{"class":1387},[1381,4528,1403],{"class":1387},[1381,4530,1406],{"class":1387},[1381,4532,4533],{"class":1383,"line":1598},[1381,4534,3328],{"class":1387},[1381,4536,4537,4539,4541,4543,4545],{"class":1383,"line":1618},[1381,4538,2510],{"class":1387},[1381,4540,1588],{"class":1604},[1381,4542,1400],{"class":1387},[1381,4544,1403],{"class":1387},[1381,4546,1595],{"class":1387},[1381,4548,4549,4551,4553,4555,4557,4559,4561],{"class":1383,"line":1624},[1381,4550,2623],{"class":1387},[1381,4552,1605],{"class":2513},[1381,4554,1400],{"class":1387},[1381,4556,1403],{"class":1387},[1381,4558,1428],{"class":1387},[1381,4560,1504],{"class":1431},[1381,4562,1457],{"class":1387},[1381,4564,4565],{"class":1383,"line":1639},[1381,4566,3380],{"class":1387},[1381,4568,4569,4571,4573,4575,4577],{"class":1383,"line":1644},[1381,4570,2510],{"class":1387},[1381,4572,1629],{"class":1604},[1381,4574,1400],{"class":1387},[1381,4576,1403],{"class":1387},[1381,4578,1636],{"class":1387},[1381,4580,4581],{"class":1383,"line":1650},[1381,4582,2547],{"class":1387},[1381,4584,4585],{"class":1383,"line":2191},[1381,4586,2552],{"class":1387},[1381,4588,4589],{"class":1383,"line":2204},[1381,4590,4591],{"class":1387},"        },\n",[1381,4593,4594],{"class":1383,"line":2209},[1381,4595,2066],{"class":1387},[1381,4597,4598,4600,4602,4604,4606],{"class":1383,"line":2227},[1381,4599,2495],{"class":1387},[1381,4601,1397],{"class":1420},[1381,4603,1400],{"class":1387},[1381,4605,1403],{"class":1387},[1381,4607,1406],{"class":1387},[1381,4609,4610],{"class":1383,"line":2232},[1381,4611,3328],{"class":1387},[1381,4613,4614,4616,4618,4620,4622,4624,4627,4629],{"class":1383,"line":2237},[1381,4615,2510],{"class":1387},[1381,4617,1421],{"class":1604},[1381,4619,1400],{"class":1387},[1381,4621,1403],{"class":1387},[1381,4623,1428],{"class":1387},[1381,4625,4626],{"class":1431},"2020-12-01",[1381,4628,1400],{"class":1387},[1381,4630,1437],{"class":1387},[1381,4632,4633,4635,4637,4639,4641,4643,4646],{"class":1383,"line":2242},[1381,4634,2510],{"class":1387},[1381,4636,1445],{"class":1604},[1381,4638,1400],{"class":1387},[1381,4640,1403],{"class":1387},[1381,4642,1428],{"class":1387},[1381,4644,4645],{"class":1431},"2020-12-31",[1381,4647,1457],{"class":1387},[1381,4649,4650],{"class":1383,"line":2247},[1381,4651,2547],{"class":1387},[1381,4653,4654],{"class":1383,"line":2260},[1381,4655,4222],{"class":1387},[1381,4657,4658,4660,4662,4664,4666],{"class":1383,"line":2265},[1381,4659,2495],{"class":1387},[1381,4661,1477],{"class":1420},[1381,4663,1400],{"class":1387},[1381,4665,1403],{"class":1387},[1381,4667,1406],{"class":1387},[1381,4669,4670],{"class":1383,"line":2283},[1381,4671,3328],{"class":1387},[1381,4673,4674,4676,4678,4680,4682,4684,4686],{"class":1383,"line":2288},[1381,4675,2510],{"class":1387},[1381,4677,1341],{"class":1604},[1381,4679,1400],{"class":1387},[1381,4681,1403],{"class":1387},[1381,4683,1428],{"class":1387},[1381,4685,1504],{"class":1431},[1381,4687,1457],{"class":1387},[1381,4689,4690],{"class":1383,"line":2293},[1381,4691,2547],{"class":1387},[1381,4693,4694],{"class":1383,"line":2306},[1381,4695,2552],{"class":1387},[1381,4697,4698],{"class":1383,"line":2311},[1381,4699,2090],{"class":1387},[1381,4701,4702],{"class":1383,"line":2329},[1381,4703,4704],{"class":1387},"    ]\n",[1381,4706,4707],{"class":1383,"line":2334},[1381,4708,4709],{"class":1387}," }\n",[11,4711,4713],{"id":4712},"pivot-queries","Pivot queries",[16,4715,4716,4717,4721,4722,4725,4726,4729],{},"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 ",[949,4718,4720],{"href":1275,"rel":4719},[953],"article on the original API version v4",". In GA4 API, pivots can be obtained using either ",[23,4723,4724],{},"runPivotReport"," (for a single request) or ",[23,4727,4728],{},"batchRunPivotReports"," (for multiple requests) methods.",[16,4731,4732],{},"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.",[16,4734,4735],{},"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.",[16,4737,4738,4739,4742,4743,4746,4747,4749,4750,4753,4754,4756,4757,4759],{},"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 ",[80,4740,4741],{},"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 ",[80,4744,4745],{},"pivots"," parameter array. The ",[80,4748,4741],{}," gives you the combination of values for those dimensions that you write together within ",[80,4751,4752],{},"fieldNames"," parameter of one item of the ",[80,4755,4745],{}," array and it gives you a list of values for single dimensions inside one item of the ",[80,4758,4745],{}," array. At the moment, it is up to you to construct the pivot table from these indicators.",[1373,4761,4763],{"className":1375,"code":4762,"language":1377,"meta":35,"style":35},"{\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",[80,4764,4765,4769,4782,4787,4804,4809,4813,4829,4834,4839,4851,4855,4871,4875,4879,4891,4895,4913,4929,4933,4937,4949,4953,4965,4974,4979,4983,4987,4999,5007,5011,5015,5020],{"__ignoreMap":35},[1381,4766,4767],{"class":1383,"line":1384},[1381,4768,1388],{"class":1387},[1381,4770,4771,4774,4776,4778,4780],{"class":1383,"line":975},[1381,4772,4773],{"class":1387},"   \"",[1381,4775,1524],{"class":1396},[1381,4777,1400],{"class":1387},[1381,4779,1403],{"class":1387},[1381,4781,1406],{"class":1387},[1381,4783,4784],{"class":1383,"line":982},[1381,4785,4786],{"class":1387},"     {\n",[1381,4788,4789,4792,4794,4796,4798,4800,4802],{"class":1383,"line":1414},[1381,4790,4791],{"class":1387},"       \"",[1381,4793,1341],{"class":1420},[1381,4795,1400],{"class":1387},[1381,4797,1403],{"class":1387},[1381,4799,1428],{"class":1387},[1381,4801,649],{"class":1431},[1381,4803,1457],{"class":1387},[1381,4805,4806],{"class":1383,"line":1440},[1381,4807,4808],{"class":1387},"     },\n",[1381,4810,4811],{"class":1383,"line":1460},[1381,4812,4786],{"class":1387},[1381,4814,4815,4817,4819,4821,4823,4825,4827],{"class":1383,"line":1466},[1381,4816,4791],{"class":1387},[1381,4818,1341],{"class":1420},[1381,4820,1400],{"class":1387},[1381,4822,1403],{"class":1387},[1381,4824,1428],{"class":1387},[1381,4826,3395],{"class":1431},[1381,4828,1457],{"class":1387},[1381,4830,4831],{"class":1383,"line":1472},[1381,4832,4833],{"class":1387},"     }\n",[1381,4835,4836],{"class":1383,"line":1486},[1381,4837,4838],{"class":1387},"   ],\n",[1381,4840,4841,4843,4845,4847,4849],{"class":1383,"line":1491},[1381,4842,4773],{"class":1387},[1381,4844,1477],{"class":1396},[1381,4846,1400],{"class":1387},[1381,4848,1403],{"class":1387},[1381,4850,1406],{"class":1387},[1381,4852,4853],{"class":1383,"line":1509},[1381,4854,4786],{"class":1387},[1381,4856,4857,4859,4861,4863,4865,4867,4869],{"class":1383,"line":1514},[1381,4858,4791],{"class":1387},[1381,4860,1341],{"class":1420},[1381,4862,1400],{"class":1387},[1381,4864,1403],{"class":1387},[1381,4866,1428],{"class":1387},[1381,4868,1504],{"class":1431},[1381,4870,1457],{"class":1387},[1381,4872,4873],{"class":1383,"line":1519},[1381,4874,4833],{"class":1387},[1381,4876,4877],{"class":1383,"line":1533},[1381,4878,4838],{"class":1387},[1381,4880,4881,4883,4885,4887,4889],{"class":1383,"line":1538},[1381,4882,4773],{"class":1387},[1381,4884,1397],{"class":1396},[1381,4886,1400],{"class":1387},[1381,4888,1403],{"class":1387},[1381,4890,1406],{"class":1387},[1381,4892,4893],{"class":1383,"line":1555},[1381,4894,4786],{"class":1387},[1381,4896,4897,4899,4901,4903,4905,4907,4909,4911],{"class":1383,"line":1560},[1381,4898,4791],{"class":1387},[1381,4900,1421],{"class":1420},[1381,4902,1400],{"class":1387},[1381,4904,1403],{"class":1387},[1381,4906,1428],{"class":1387},[1381,4908,1432],{"class":1431},[1381,4910,1400],{"class":1387},[1381,4912,1437],{"class":1387},[1381,4914,4915,4917,4919,4921,4923,4925,4927],{"class":1383,"line":1565},[1381,4916,4791],{"class":1387},[1381,4918,1445],{"class":1420},[1381,4920,1400],{"class":1387},[1381,4922,1403],{"class":1387},[1381,4924,1428],{"class":1387},[1381,4926,1454],{"class":1431},[1381,4928,1457],{"class":1387},[1381,4930,4931],{"class":1383,"line":1578},[1381,4932,4833],{"class":1387},[1381,4934,4935],{"class":1383,"line":1583},[1381,4936,4838],{"class":1387},[1381,4938,4939,4941,4943,4945,4947],{"class":1383,"line":1598},[1381,4940,4773],{"class":1387},[1381,4942,4745],{"class":1396},[1381,4944,1400],{"class":1387},[1381,4946,1403],{"class":1387},[1381,4948,1406],{"class":1387},[1381,4950,4951],{"class":1383,"line":1618},[1381,4952,4786],{"class":1387},[1381,4954,4955,4957,4959,4961,4963],{"class":1383,"line":1624},[1381,4956,4791],{"class":1387},[1381,4958,4752],{"class":1420},[1381,4960,1400],{"class":1387},[1381,4962,1403],{"class":1387},[1381,4964,1406],{"class":1387},[1381,4966,4967,4970,4972],{"class":1383,"line":1639},[1381,4968,4969],{"class":1387},"         \"",[1381,4971,3395],{"class":1431},[1381,4973,1457],{"class":1387},[1381,4975,4976],{"class":1383,"line":1644},[1381,4977,4978],{"class":1387},"       ]\n",[1381,4980,4981],{"class":1383,"line":1650},[1381,4982,4808],{"class":1387},[1381,4984,4985],{"class":1383,"line":2191},[1381,4986,1411],{"class":1387},[1381,4988,4989,4991,4993,4995,4997],{"class":1383,"line":2204},[1381,4990,4791],{"class":1387},[1381,4992,4752],{"class":1420},[1381,4994,1400],{"class":1387},[1381,4996,1403],{"class":1387},[1381,4998,1406],{"class":1387},[1381,5000,5001,5003,5005],{"class":1383,"line":2209},[1381,5002,4969],{"class":1387},[1381,5004,649],{"class":1431},[1381,5006,1457],{"class":1387},[1381,5008,5009],{"class":1383,"line":2227},[1381,5010,4978],{"class":1387},[1381,5012,5013],{"class":1383,"line":2232},[1381,5014,4833],{"class":1387},[1381,5016,5017],{"class":1383,"line":2237},[1381,5018,5019],{"class":1387},"   ]\n",[1381,5021,5022],{"class":1383,"line":2242},[1381,5023,4709],{"class":1387},[728,5025,5026],{},[731,5027,5028,5043],{},[734,5029,5030],{},[737,5031,5032,5034,5037,5040],{},[702,5033,649],{},[702,5035,5036],{},"desktop",[702,5038,5039],{},"mobile",[702,5041,5042],{},"tablet",[757,5044,5045,5058,5072],{},[737,5046,5047,5049,5052,5055],{},[762,5048,1432],{},[762,5050,5051],{},"1230",[762,5053,5054],{},"990",[762,5056,5057],{},"210",[737,5059,5060,5063,5066,5069],{},[762,5061,5062],{},"2021-01-05",[762,5064,5065],{},"1410",[762,5067,5068],{},"1280",[762,5070,5071],{},"150",[737,5073,5074,5076,5079,5082],{},[762,5075,1454],{},[762,5077,5078],{},"1370",[762,5080,5081],{},"1290",[762,5083,5084],{},"180",[16,5086,5087],{},[33,5088],{"alt":35,"src":5089,"title":5090},"\u002Fupload\u002Fdata-results.webp","Data Results",[11,5092,5094],{"id":5093},"python-example","Python example",[16,5096,5097],{},"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.",[16,5099,5100,5101,5104,5105,5108],{},"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 ",[80,5102,5103],{},"property_id"," as an argument. For the setup on Windows, run the code below in Command Prompt. Replace the place holder ",[80,5106,5107],{},"\u003Cyour-env>"," with the selected name for your environment.",[1373,5110,5114],{"className":5111,"code":5112,"language":5113,"meta":35,"style":35},"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",[80,5115,5116,5121,5126,5131],{"__ignoreMap":35},[1381,5117,5118],{"class":1383,"line":1384},[1381,5119,5120],{},"pip install virtualenv\n",[1381,5122,5123],{"class":1383,"line":975},[1381,5124,5125],{},"  virtualenv \u003Cyour-env>\n",[1381,5127,5128],{"class":1383,"line":982},[1381,5129,5130],{},"  \u003Cyour-env>\\Scripts\\activate\n",[1381,5132,5133],{"class":1383,"line":1414},[1381,5134,5135],{},"  \u003Cyour-env>\\Scripts\\pip.exe install google-analytics-data pandas python-dotenv\n",[16,5137,5138,5139,5142],{},"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 ",[80,5140,5141],{},"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:",[1373,5144,5146],{"className":5111,"code":5145,"language":5113,"meta":35,"style":35},"SERVICE_TOKEN_PATH=\"C:\u002FUsers\u002FYourUser\u002FDocuments\u002Fservice_account_token.json\"\n",[80,5147,5148],{"__ignoreMap":35},[1381,5149,5150],{"class":1383,"line":1384},[1381,5151,5145],{},[16,5153,5154,5155,118],{},"If you need any help creating the service token, refer to ",[949,5156,5159],{"href":5157,"rel":5158},"https:\u002F\u002Fcloud.google.com\u002Fiam\u002Fdocs\u002Fcreating-managing-service-accounts.",[953],"official documents",[16,5161,5162,5163,118],{},"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 ",[949,5164,5167],{"href":5165,"rel":5166},"https:\u002F\u002Fgithub.com\u002Fgoogleapis\u002Fpython-analytics-data",[953],"check the client library source code",[1373,5169,5173],{"className":5170,"code":5171,"language":5172,"meta":35,"style":35},"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",[80,5174,5175,5180,5185,5190,5195,5200,5205,5210,5215,5220,5225,5230,5235,5239,5244,5249,5253,5258,5263,5268,5273,5278,5283,5288,5292,5297,5302,5307,5312,5317,5322,5327,5332,5337,5342,5346,5351,5356,5361,5366,5371,5376,5380,5384,5389,5394],{"__ignoreMap":35},[1381,5176,5177],{"class":1383,"line":1384},[1381,5178,5179],{},"    from dotenv import load_dotenv\n",[1381,5181,5182],{"class":1383,"line":975},[1381,5183,5184],{},"    import os\n",[1381,5186,5187],{"class":1383,"line":982},[1381,5188,5189],{},"    import json\n",[1381,5191,5192],{"class":1383,"line":1414},[1381,5193,5194],{},"    import pandas as pd\n",[1381,5196,5197],{"class":1383,"line":1440},[1381,5198,5199],{},"    from google.analytics.data_v1beta import BetaAnalyticsDataClient\n",[1381,5201,5202],{"class":1383,"line":1460},[1381,5203,5204],{},"    from google.analytics.data_v1beta.types import DateRange, Dimension, Metric, RunReportRequest\n",[1381,5206,5207],{"class":1383,"line":1466},[1381,5208,5209],{},"    \n",[1381,5211,5212],{"class":1383,"line":1472},[1381,5213,5214],{},"    # Setting \n",[1381,5216,5217],{"class":1383,"line":1486},[1381,5218,5219],{},"    #(.env file is located in the same location and contains SERVICE_TOKEN_PATH=[local-path-to-Google-service-token-with-data-access])\n",[1381,5221,5222],{"class":1383,"line":1491},[1381,5223,5224],{},"    load_dotenv()\n",[1381,5226,5227],{"class":1383,"line":1509},[1381,5228,5229],{},"    SERVICE_TOKEN_PATH = os.getenv('SERVICE_TOKEN_PATH')\n",[1381,5231,5232],{"class":1383,"line":1514},[1381,5233,5234],{},"    property_id = '\u003Cset-your-property-ID-here>'\n",[1381,5236,5237],{"class":1383,"line":1519},[1381,5238,5209],{},[1381,5240,5241],{"class":1383,"line":1533},[1381,5242,5243],{},"    def sample_run_report(property_id):\n",[1381,5245,5246],{"class":1383,"line":1538},[1381,5247,5248],{},"        \"\"\"Runs a simple report on a Google Analytics 4 property.\"\"\"\n",[1381,5250,5251],{"class":1383,"line":1555},[1381,5252,5209],{},[1381,5254,5255],{"class":1383,"line":1560},[1381,5256,5257],{},"        client = AlphaAnalyticsDataClient.from_service_account_file(SERVICE_TOKEN_PATH)\n",[1381,5259,5260],{"class":1383,"line":1565},[1381,5261,5262],{},"        request = RunReportRequest(property=f\"properties\u002F{​property_id}​\",\n",[1381,5264,5265],{"class":1383,"line":1578},[1381,5266,5267],{},"                                   dimensions=[Dimension(name='date'), Dimension(name='country'), Dimension(name='city')],\n",[1381,5269,5270],{"class":1383,"line":1583},[1381,5271,5272],{},"                                   metrics=[Metric(name='activeUsers'), Metric(name='sessions')],\n",[1381,5274,5275],{"class":1383,"line":1598},[1381,5276,5277],{},"                                   date_ranges=[DateRange(start_date='2021-01-01', end_date='yesterday')])\n",[1381,5279,5280],{"class":1383,"line":1618},[1381,5281,5282],{},"        response = client.run_report(request)\n",[1381,5284,5285],{"class":1383,"line":1624},[1381,5286,5287],{},"        return response\n",[1381,5289,5290],{"class":1383,"line":1639},[1381,5291,5209],{},[1381,5293,5294],{"class":1383,"line":1644},[1381,5295,5296],{},"    def sample_extract_data(response):\n",[1381,5298,5299],{"class":1383,"line":1650},[1381,5300,5301],{},"        \"\"\"Extracts data from GA 4 Data API response as Pandas Dataframe \"\"\"\n",[1381,5303,5304],{"class":1383,"line":2191},[1381,5305,5306],{},"        data_dict = {}\n",[1381,5308,5309],{"class":1383,"line":2204},[1381,5310,5311],{},"        for row in response.rows:\n",[1381,5313,5314],{"class":1383,"line":2209},[1381,5315,5316],{},"                data_dict_row = []\n",[1381,5318,5319],{"class":1383,"line":2227},[1381,5320,5321],{},"                for i in range(len(row.dimension_values)):\n",[1381,5323,5324],{"class":1383,"line":2232},[1381,5325,5326],{},"                    data_dict_row.append(row.dimension_values[i].value)\n",[1381,5328,5329],{"class":1383,"line":2237},[1381,5330,5331],{},"                for j in range(len(row.metric_values)):\n",[1381,5333,5334],{"class":1383,"line":2242},[1381,5335,5336],{},"                    data_dict_row.append(row.metric_values[j].value)\n",[1381,5338,5339],{"class":1383,"line":2247},[1381,5340,5341],{},"                data_dict[response.rows.index(row)] = data_dict_row\n",[1381,5343,5344],{"class":1383,"line":2260},[1381,5345,5209],{},[1381,5347,5348],{"class":1383,"line":2265},[1381,5349,5350],{},"        columns_list = []\n",[1381,5352,5353],{"class":1383,"line":2283},[1381,5354,5355],{},"        for dim_header in response.dimension_headers:\n",[1381,5357,5358],{"class":1383,"line":2288},[1381,5359,5360],{},"            columns_list.append(dim_header.name)\n",[1381,5362,5363],{"class":1383,"line":2293},[1381,5364,5365],{},"        for met_header in response.metric_headers:\n",[1381,5367,5368],{"class":1383,"line":2306},[1381,5369,5370],{},"            columns_list.append(met_header.name)\n",[1381,5372,5373],{"class":1383,"line":2311},[1381,5374,5375],{},"        return pd.DataFrame.from_dict(data_dict, orient='index', columns = columns_list)\n",[1381,5377,5378],{"class":1383,"line":2329},[1381,5379,5209],{},[1381,5381,5382],{"class":1383,"line":2334},[1381,5383,5209],{},[1381,5385,5386],{"class":1383,"line":2339},[1381,5387,5388],{},"    if __name__ == \"__main__\":\n",[1381,5390,5391],{"class":1383,"line":2344},[1381,5392,5393],{},"        query_response = sample_run_report(property_id)\n",[1381,5395,5396],{"class":1383,"line":2349},[1381,5397,5398],{},"        sample_extract_data(query_response)\n",[11,5400,1189],{"id":1188},[16,5402,5403],{},"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.",[74,5405,5406,5407,5411,5412,5411,5416,5411,5420,5424,5425,5430],{},"\nMore information about the methods is provided in official Google’s documentation on the GA4 API (\n",[949,5408,1310],{"href":5409,"rel":5410},"https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fdevguides\u002Freporting\u002Fdata\u002Fv1\u002Frest\u002Fv1beta\u002Fproperties\u002FrunReport",[953],"\n, \n",[949,5413,4724],{"href":5414,"rel":5415},"https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fdevguides\u002Freporting\u002Fdata\u002Fv1\u002Frest\u002Fv1beta\u002Fproperties\u002FrunPivotReport",[953],[949,5417,4347],{"href":5418,"rel":5419},"https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fdevguides\u002Freporting\u002Fdata\u002Fv1\u002Frest\u002Fv1beta\u002Fproperties\u002FbatchRunReports",[953],[949,5421,4728],{"href":5422,"rel":5423},"https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fdevguides\u002Freporting\u002Fdata\u002Fv1\u002Frest\u002Fv1beta\u002Fproperties\u002FbatchRunPivotReports",[953],"\n) where you can also run the queries in the API Explorer. For easier use, Google provides a comprehensive \n",[949,5426,5429],{"href":5427,"rel":5428},"https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fdevguides\u002Freporting\u002Fdata\u002Fv1\u002Fapi-schema",[953],"list","\n of all currently available dimensions and metrics.\n",[969,5432,5433],{"link":971,"button":972},"\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",[5435,5436,5437],"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":35,"searchDepth":975,"depth":975,"links":5439},[5440,5444,5450,5451,5452,5453],{"id":1303,"depth":975,"text":1304,"children":5441},[5442,5443],{"id":1319,"depth":982,"text":1322},{"id":1912,"depth":982,"text":1913},{"id":2948,"depth":975,"text":2949,"children":5445},[5446,5447,5448,5449],{"id":2952,"depth":982,"text":2953},{"id":3191,"depth":982,"text":3192},{"id":3735,"depth":982,"text":3736},{"id":4309,"depth":982,"text":4310},{"id":4340,"depth":975,"text":4341},{"id":4712,"depth":975,"text":4713},{"id":5093,"depth":975,"text":5094},{"id":1188,"depth":975,"text":1189},"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.","\u002Fupload\u002Fga4-api-banner.webp",{},"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.","\u002Fen\u002Fblog\u002Fnew-data-api-for-google-analytics-4","2021-03-30T02:12:10.000+00:00",19.75,"20 min read",[5463,5464],"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":1252,"description":5454},"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",1789131822725]