{"id":27199,"date":"2023-01-03T10:08:41","date_gmt":"2023-01-03T10:08:41","guid":{"rendered":"https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/"},"modified":"2023-01-03T10:08:41","modified_gmt":"2023-01-03T10:08:41","slug":"how-to-access-google-analytics-api-via-python","status":"publish","type":"post","link":"https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/","title":{"rendered":"How To Access Google Analytics API Via Python"},"content":{"rendered":"<p> <a href=\"https:\/\/go.fiverr.com\/visit\/?bta=1052423&nci=17043\" Target=\"_Top\"><img loading=\"lazy\" decoding=\"async\" border=\"0\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/fiverr.ck-cdn.com\/tn\/serve\/?cid=40081059\"  width=\"601\" height=\"201\"><\/a>\n<\/p>\n<div id=\"narrow-cont\">\n<p>The Google Analytics API provides access to Google Analytics (GA) report data such as pageviews, sessions, traffic source, and bounce rate.<\/p>\n<p>The <a href=\"https:\/\/developers.google.com\/analytics\/devguides\/reporting\/core\/v4\" target=\"_blank\" rel=\"noopener\">official Google documentation<\/a> explains that it can be used to:<\/p>\n<ul>\n<li>Build custom dashboards to display GA data.<\/li>\n<li>Automate complex reporting tasks.<\/li>\n<li>Integrate with other applications.<\/li>\n<\/ul>\n<p>You can access the API response using several different methods, including Java, PHP, and JavaScript, but this article, in particular, will focus on accessing and exporting data using <a href=\"https:\/\/www.searchenginejournal.com\/python-machine-learning-technical-seo\/430000\/\">Python<\/a>.<\/p>\n<p>This article will just cover some of the methods that can be used to access different subsets of data using different metrics and dimensions.<\/p>\n<p>I hope to write a follow-up guide exploring different ways you can analyze, <a href=\"https:\/\/www.searchenginejournal.com\/essential-data-studio-visualizations-paid-search-marketers\/316509\/\">visualize<\/a>, and combine the data.<\/p>\n<h2>Setting Up The API<\/h2>\n<h3>Creating A Google Service Account<\/h3>\n<p>The first step is to create a project or select one within your <a href=\"https:\/\/console.cloud.google.com\/iam-admin\/serviceaccounts?utm_source=developers.google.com&amp;utm_medium=referral\" target=\"_blank\" rel=\"noopener\">Google Service Account<\/a>.<\/p>\n<p>Once this has been created, the next step is to select the <em>+ Create Service Account<\/em> button.<\/p>\n<div style=\"width: 1904px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" alt=\"Google Service Account\" width=\"1894\" height=\"502\" data-srcset=\"\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-12-at-20.19.26-639b8131d43dc-sej.png\" class=\" b-lazy pcimg\"\/><span class=\"wp-caption-text\">Screenshot from Google Cloud, December 2022<\/span><noscript><img decoding=\"async\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-12-at-20.19.26-639b8131d43dc-sej.png\" alt=\"Google Service Account\"\/><\/noscript><\/div>\n<p>You will then be promoted to add some details such as a name, ID, and description.<\/p>\n<div style=\"width: 1162px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" alt=\"Service Account Details\" width=\"1152\" height=\"1124\" data-srcset=\"\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-12-at-20.20.21-639b81474320f-sej.png\" class=\" b-lazy pcimg\"\/><span class=\"wp-caption-text\">Screenshot from Google Cloud, December 2022<\/span><noscript><img decoding=\"async\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-12-at-20.20.21-639b81474320f-sej.png\" alt=\"Service Account Details\"\/><\/noscript><\/div>\n<p>Once the service account has been created, navigate to the <em>KEYS<\/em> section and add a new key.<\/p>\n<div style=\"width: 1164px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" alt=\"Service Account Key\" width=\"1154\" height=\"700\" data-srcset=\"\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-12-at-20.20.42-639b8150b0b55-sej.png\" class=\" b-lazy pcimg\"\/><span class=\"wp-caption-text\">Screenshot from Google Cloud, December 2022<\/span><noscript><img decoding=\"async\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-12-at-20.20.42-639b8150b0b55-sej.png\" alt=\"Service Account Key\"\/><\/noscript><\/div>\n<p>This will prompt you to create and download a private key. In this instance, select JSON, and then create and wait for the file to download.<\/p>\n<div style=\"width: 1114px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" alt=\"JSON Credentials Key\" width=\"1104\" height=\"696\" data-srcset=\"\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-12-at-20.20.53-639b815a294a0-sej.png\" class=\" b-lazy pcimg\"\/><span class=\"wp-caption-text\">Screenshot from Google Cloud, December 2022<\/span><noscript><img decoding=\"async\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-12-at-20.20.53-639b815a294a0-sej.png\" alt=\"JSON Credentials Key\"\/><\/noscript><\/div>\n<h3>Add To Google Analytics Account<\/h3>\n<p>You will also want to take a copy of the email that has been generated for the service account \u2013 this can be found on the main account page.<\/p>\n<div style=\"width: 572px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" alt=\"Google Account Email\" width=\"562\" height=\"202\" data-srcset=\"\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-12-at-20.21.43-639b8161938bf-sej.png\" class=\" b-lazy pcimg\"\/><span class=\"wp-caption-text\">Screenshot from Google Cloud, December 2022<\/span><noscript><img decoding=\"async\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-12-at-20.21.43-639b8161938bf-sej.png\" alt=\"Google Account Email\"\/><\/noscript><\/div>\n<p>The next step is to add that email as a user in Google Analytics with Analyst permissions.<\/p>\n<div style=\"width: 2466px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" alt=\"Email in Google Analytics\" width=\"2456\" height=\"86\" data-srcset=\"\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-12-at-20.21.55-639b8165807a0-sej.png\" class=\" b-lazy pcimg\"\/><span class=\"wp-caption-text\">Screenshot from Google Analytics, December 2022<\/span><noscript><img decoding=\"async\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-12-at-20.21.55-639b8165807a0-sej.png\" alt=\"Email in Google Analytics\"\/><\/noscript><\/div>\n<h3>Enabling The API<\/h3>\n<p>The final and arguably most important step is ensuring you have enabled access to the API. To do this, ensure you are in the correct project and follow <a href=\"https:\/\/console.cloud.google.com\/start\/api?id=analyticsreporting.googleapis.com&amp;credential=client_key&amp;utm_source=developers.google.com&amp;utm_medium=referral\" target=\"_blank\" rel=\"noopener\">this link to enable access<\/a>.<\/p>\n<p>Then, follow the steps to enable it when promoted.<\/p>\n<div style=\"width: 1550px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" alt=\"Enabling the API\" width=\"1540\" height=\"484\" data-srcset=\"\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-12-at-20.27.38-639b816cc6a49-sej.png\" class=\" b-lazy pcimg\"\/><span class=\"wp-caption-text\">Screenshot from Google Cloud, December 2022<\/span><noscript><img decoding=\"async\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-12-at-20.27.38-639b816cc6a49-sej.png\" alt=\"Enabling the API\"\/><\/noscript><\/div>\n<p>This is needed in order to access the API. If you miss this step, you will be prompted to complete it when first running the script.<\/p>\n<h2>Accessing The Google Analytics API With Python<\/h2>\n<p>Now everything is set up in our service account, we can start writing the script to export the data.<\/p>\n<p>I chose <a href=\"https:\/\/jupyter.org\/\" target=\"_blank\" rel=\"noopener\">Jupyter Notebooks<\/a> to create this, but you can also use other integrated developer environments (IDEs) including <a href=\"https:\/\/www.jetbrains.com\/pycharm\/\" target=\"_blank\" rel=\"noopener\">PyCharm<\/a> or <a href=\"https:\/\/code.visualstudio.com\/\" target=\"_blank\" rel=\"noopener\">VSCode<\/a>.<\/p>\n<h3>Installing Libraries<\/h3>\n<p>The first step is to install the libraries that are needed to run the rest of the code.<\/p>\n<p>Some are unique to the analytics API, and others are useful for future sections of the code.<\/p>\n<pre>!pip install --upgrade google-api-python-client&#13;\n!pip3 install --upgrade oauth2client&#13;\nfrom apiclient.discovery import build&#13;\nfrom oauth2client.service_account import ServiceAccountCredentials&#13;\n!pip install connect&#13;\n!pip install functions&#13;\nimport connect&#13;\n<\/pre>\n<p>Note: When using pip in a Jupyter notebook, add the ! \u2013 if running in the command line or another IDE, the ! isn\u2019t needed.<\/p>\n<h3>Creating A Service Build<\/h3>\n<p>The next step is to set up our scope, which is the read-only analytics API authentication link.<\/p>\n<p>This is followed by the client secrets JSON download that was generated when creating the private key. This is used in a similar way to an API key.<\/p>\n<p>To easily access this file within your code, ensure you have saved the JSON file in the same folder as the code file. This can then easily be called with the KEY_FILE_LOCATION function.<\/p>\n<p>Finally, add the view ID from the analytics account with which you would like to access the data.<\/p>\n<div style=\"width: 688px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" alt=\"Google Analytics View ID\" width=\"678\" height=\"216\" data-srcset=\"\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-13-at-20.26.12-639b8177ee812-sej.png\" class=\" b-lazy pcimg\"\/><span class=\"wp-caption-text\">Screenshot from author, December 2022<\/span><noscript><img decoding=\"async\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-13-at-20.26.12-639b8177ee812-sej.png\" alt=\"Google Analytics View ID\"\/><\/noscript><\/div>\n<p>Altogether this will look like the following. We will reference these functions throughout our code.<\/p>\n<pre>SCOPES = ['https:\/\/www.googleapis.com\/auth\/analytics.readonly']&#13;\nKEY_FILE_LOCATION = 'client_secrets.json'&#13;\nVIEW_ID = 'XXXXX'<\/pre>\n<p>Once we have added our private key file, we can add this to the credentials function by calling the file and setting it up through the ServiceAccountCredentials step.<\/p>\n<p>Then, set up the build report, calling the analytics reporting API V4, and our already defined credentials from above.<\/p>\n<pre>credentials = ServiceAccountCredentials.from_json_keyfile_name(KEY_FILE_LOCATION, SCOPES)&#13;\nservice = build('analyticsreporting', 'v4', credentials=credentials)<\/pre>\n<h3>Writing The Request Body<\/h3>\n<p>Once we have everything set up and defined, the real fun begins.<\/p>\n<p>From the API service build, there is the ability to select the elements from the response that we want to access. This is called a ReportRequest object and requires the following as a minimum:<\/p>\n<ul>\n<li>A valid view ID for the viewId field.<\/li>\n<li>At least one valid entry in the dateRanges field.<\/li>\n<li>At least one valid entry in the metrics field.<\/li>\n<\/ul>\n<p><strong>View ID<\/strong><\/p>\n<p>As mentioned, there are a few things that are needed during this build stage, starting with our viewId. As we have already defined previously, we just need to call that function name (VIEW_ID) rather than adding the whole view ID again.<\/p>\n<p>If you wanted to collect data from a different analytics view in the future, you would just need to change the ID in the initial code block rather than both.<\/p>\n<p><strong>Date Range<\/strong><\/p>\n<p>Then we can add the date range for the dates that we want to collect the data for. This consists of a start date and an end date.<\/p>\n<p>There are a couple of ways to write this within the build request.<\/p>\n<p>You can select defined dates, for example, between two dates, by adding the date in a year-month-date format, \u2018startDate\u2019: \u20182022-10-27\u2019, \u2018endDate\u2019: \u20182022-11-27\u2019.<\/p>\n<p>Or, if you want to view data from the last 30 days, you can set the start date as \u201830daysAgo\u2019 and the end date as \u2018today.\u2019<\/p>\n<p><strong>Metrics And Dimensions<\/strong><\/p>\n<p>The final step of the basic response call is setting the metrics and dimensions. Metrics are the quantitative measurements from Google Analytics, such as session count, session duration, and bounce rate.<\/p>\n<p>Dimensions are the characteristics of users, their sessions, and their actions. For example, page path, traffic source, and keywords used.<\/p>\n<p>There are a lot of different metrics and dimensions that can be accessed. I won\u2019t go through all of them in this article, but they can all be found together with additional information and attributes <a href=\"https:\/\/ga-dev-tools.web.app\/dimensions-metrics-explorer\/\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<p>Anything you can access in Google Analytics you can access in the API. This includes goal conversions, starts and values, the browser device used to access the website, landing page, second-page path tracking, and internal search, site speed, and audience metrics.<\/p>\n<p>Both the metrics and dimensions are added in a dictionary format, using key:value pairs. For metrics, the key will be \u2018expression\u2019 followed by the colon (:) and then the value of our metric, which will have a specific format.<\/p>\n<p>For example, if we wanted to get a count of all sessions, we would add \u2018expression\u2019: \u2018ga:sessions\u2019. Or \u2018expression\u2019: \u2018ga:newUsers\u2019 if we wanted to see a count of all new users.<\/p>\n<p>With dimensions, the key will be \u2018name\u2019 followed by the colon again and the value of the dimension. For example, if we wanted to extract the different page paths, it would be \u2018name\u2019: \u2018ga:pagePath\u2019.<\/p>\n<p>Or \u2018name\u2019: \u2018ga:medium\u2019 to see the different traffic source referrals to the site.<\/p>\n<p><strong>Combining Dimensions And Metrics<\/strong><\/p>\n<p>The real value is in combining metrics and dimensions to extract the key insights we are most interested in.<\/p>\n<p>For example, to see a count of all sessions that have been created from different traffic sources, we can set our metric to be ga:sessions and our dimension to be ga:medium.<\/p>\n<pre>response = service.reports().batchGet(&#13;\n    body={&#13;\n        'reportRequests': [&#13;\n        {&#13;\n          'viewId': VIEW_ID,&#13;\n          'dateRanges': [{'startDate': '30daysAgo', 'endDate': 'today'}],&#13;\n          'metrics': [{'expression': 'ga:sessions'}],&#13;\n          'dimensions': [{'name': 'ga:medium'}]&#13;\n        }]&#13;\n      }&#13;\n  ).execute()&#13;\n<\/pre>\n<h3>Creating A DataFrame<\/h3>\n<p>The response we get from the API is in the form of a dictionary, with all of the data in key:value pairs. To make the data easier to view and analyze, we can turn it into a Pandas dataframe.<\/p>\n<p>To turn our response into a dataframe, we first need to create some empty lists, to hold the metrics and dimensions.<\/p>\n<p>Then, calling the response output, we will append the data from the dimensions into the empty dimensions list and a count of the metrics into the metrics list.<\/p>\n<p>This will extract the data and add it to our previously empty lists.<\/p>\n<pre>dim = []&#13;\nmetric = []&#13;\n&#13;\nfor report in response.get('reports', []):&#13;\n&#13;\ncolumnHeader = report.get('columnHeader', {})&#13;\ndimensionHeaders = columnHeader.get('dimensions', [])&#13;\nmetricHeaders = columnHeader.get('metricHeader', {}).get('metricHeaderEntries', [])&#13;\nrows = report.get('data', {}).get('rows', [])&#13;\n&#13;\nfor row in rows:&#13;\n&#13;\ndimensions = row.get('dimensions', [])&#13;\ndateRangeValues = row.get('metrics', [])&#13;\n&#13;\nfor header, dimension in zip(dimensionHeaders, dimensions):&#13;\ndim.append(dimension)&#13;\n&#13;\nfor i, values in enumerate(dateRangeValues):&#13;\nfor metricHeader, value in zip(metricHeaders, values.get('values')):&#13;\nmetric.append(int(value))<\/pre>\n<p><strong>Adding The Response Data<\/strong><\/p>\n<p>Once the data is in those lists, we can easily turn them into a dataframe by defining the column names, in square brackets, and assigning the list values to each column.<\/p>\n<pre>df = pd.DataFrame()&#13;\ndf[\"Sessions\"]= metric&#13;\ndf[\"Medium\"]= dim&#13;\ndf= df[[\"Medium\",\"Sessions\"]]&#13;\ndf.head()&#13;\n&#13;\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter b-lazy pcimg\" alt=\"DataFrame Example \" width=\"294\" height=\"296\" data-srcset=\"\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-13-at-20.30.15-639b817e87a2c-sej.png\"\/><noscript><img decoding=\"async\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-13-at-20.30.15-639b817e87a2c-sej.png\" alt=\"DataFrame Example \"\/><\/noscript><\/pre>\n<h2>More Response Request Examples<\/h2>\n<h3>Multiple Metrics<\/h3>\n<p>There is also the ability to combine multiple metrics, with each pair added in curly brackets and separated by a comma.<\/p>\n<pre>'metrics': [&#13;\n              {\"expression\": \"ga:pageviews\"},&#13;\n              {\"expression\": \"ga:sessions\"}&#13;\n          ]&#13;\n<\/pre>\n<h3>Filtering<\/h3>\n<p>You can also request the API response only returns metrics that return certain criteria by adding metric filters. It uses the following format:<\/p>\n<pre>if {metricName} {operator} {comparisonValue}&#13;\n   return the metric<\/pre>\n<p>For example, if you only wanted to extract pageviews with more than ten views.<\/p>\n<pre>response = service.reports().batchGet(&#13;\n    body={&#13;\n        'reportRequests': [&#13;\n        {&#13;\n          'viewId': VIEW_ID,&#13;\n          'dateRanges': [{'startDate': '30daysAgo', 'endDate': 'today'}],&#13;\n          'metrics': [{'expression': 'ga:pageviews'}],&#13;\n          'dimensions': [{'name': 'ga:pagePath'}],&#13;\n&#13;\n\"metricFilterClauses\": [{&#13;\n\"filters\": [{&#13;\n\"metricName\": \"ga:pageviews\",&#13;\n\"operator\": \"GREATER_THAN\",&#13;\n\"comparisonValue\": \"10\"&#13;\n}]&#13;\n}]&#13;\n}]&#13;\n}&#13;\n).execute()<\/pre>\n<p>Filters also work for dimensions in a similar way, but the filter expressions will be slightly different due to the characteristic nature of dimensions.<\/p>\n<p>For example, if you only want to extract pageviews from users who have visited the site using the Chrome browser, you can set an EXTRACT operator and use \u2018Chrome\u2019 as the expression.<\/p>\n<pre>response = service.reports().batchGet(&#13;\n    body={&#13;\n        'reportRequests': [&#13;\n        {&#13;\n          'viewId': VIEW_ID,&#13;\n          'dateRanges': [{'startDate': '30daysAgo', 'endDate': 'today'}],&#13;\n          'metrics': [{'expression': 'ga:pageviews'}],&#13;\n          \"dimensions\": [{\"name\": \"ga:browser\"}],&#13;\n          \"dimensionFilterClauses\": [&#13;\n        {&#13;\n          \"filters\": [&#13;\n            {&#13;\n              \"dimensionName\": \"ga:browser\",&#13;\n              \"operator\": \"EXACT\",&#13;\n              \"expressions\": [\"Chrome\"]&#13;\n            }&#13;\n          ]&#13;\n        }&#13;\n      ]&#13;\n    }&#13;\n  ]&#13;\n}&#13;\n).execute()&#13;\n<\/pre>\n<h3>Expressions<\/h3>\n<p>As metrics are quantitative measures, there is also the ability to write expressions, which work similarly to calculated metrics.<\/p>\n<p>This involves defining an alias to represent the expression and completing a mathematical function on two metrics.<\/p>\n<p>For example, you can calculate completions per user by dividing the number of completions by the number of users.<\/p>\n<pre>response = service.reports().batchGet(&#13;\n    body={&#13;\n        'reportRequests': [&#13;\n        {&#13;\n          'viewId': VIEW_ID,&#13;\n          'dateRanges': [{'startDate': '30daysAgo', 'endDate': 'today'}],&#13;\n          \"metrics\":&#13;\n      [&#13;\n        {&#13;\n          \"expression\": \"ga:goal1completions\/ga:users\",&#13;\n          \"alias\": \"completions per user\"&#13;\n        }&#13;\n      ]&#13;\n    }&#13;\n  ]&#13;\n}&#13;\n).execute()&#13;\n<\/pre>\n<h3>Histograms<\/h3>\n<p>The API also lets you bucket dimensions with an integer (numeric) value into ranges using histogram buckets.<\/p>\n<p>For example, bucketing the sessions count dimension into four buckets of 1-9, 10-99, 100-199, and 200-399, you can use the HISTOGRAM_BUCKET order type and define the ranges in histogramBuckets.<\/p>\n<pre>response = service.reports().batchGet(&#13;\n    body={&#13;\n        'reportRequests': [&#13;\n        {&#13;\n          'viewId': VIEW_ID,&#13;\n          'dateRanges': [{'startDate': '30daysAgo', 'endDate': 'today'}],&#13;\n          \"metrics\": [{\"expression\": \"ga:sessions\"}],&#13;\n          \"dimensions\": [&#13;\n        {&#13;\n              \"name\": \"ga:sessionCount\",&#13;\n              \"histogramBuckets\": [\"1\",\"10\",\"100\",\"200\",\"400\"]&#13;\n        }&#13;\n      ],&#13;\n         \"orderBys\": [&#13;\n        {&#13;\n              \"fieldName\": \"ga:sessionCount\",&#13;\n              \"orderType\": \"HISTOGRAM_BUCKET\"&#13;\n        }&#13;\n      ]&#13;\n    }&#13;\n  ]&#13;\n}&#13;\n).execute()<\/pre>\n<div style=\"width: 314px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" alt=\"Histogram Example \" width=\"304\" height=\"300\" data-srcset=\"\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-13-at-20.27.10-639b817b96135-sej.png\" class=\" b-lazy pcimg\"\/><span class=\"wp-caption-text\">Screenshot from author, December 2022<\/span><noscript><img decoding=\"async\" src=\"https:\/\/mailinvest.blog\/wp-content\/themes\/breek\/assets\/images\/transparent.gif\" data-lazy=\"true\" data-src=\"https:\/\/cdn.searchenginejournal.com\/wp-content\/uploads\/2022\/12\/screenshot-2022-12-13-at-20.27.10-639b817b96135-sej.png\" alt=\"Histogram Example \"\/><\/noscript><\/div>\n<h2>In Conclusion<\/h2>\n<p>I hope this has provided you with a basic guide to accessing the Google Analytics API, writing some different requests, and collecting some meaningful insights in an easy-to-view format.<\/p>\n<p>I have added the build and request code, and the snippets shared to <a href=\"https:\/\/github.com\/rvth\/google-analytics-api\" target=\"_blank\" rel=\"noopener\">this GitHub file<\/a>.<\/p>\n<p>I will love to hear if you try any of these and your plans for exploring the data further.<\/p>\n<p><strong>More resources:<\/strong><\/p>\n<hr\/>\n<p><em>Featured Image: BestForBest\/Shutterstock<\/em><\/p>\n<\/div>\n<iframe data-lazy=\"true\" data-src=\"https:\/\/www.fiverr.com\/gig_widgets?id=U2FsdGVkX18x7XQvttUTrv1oEqmGNGTgvvCUiUoJ\/AP4z\/UyMz8lXGOLpu15jIMxBbTR0gmD5uBoFvhC4KWeALQRp3h\/X\/AwcVD0K8Wj9H\/ZzYKzcCNHosB9oS4SCJJFWiN85P9ICAc4OgCoE\/wHKIY7CDkf2\/DQ1vqGvk4smVe5cRDEmrLPCWi4FC8p40VUhSmWQ5udCm0zoJtorgWv3vbDQw0kKYkwn39ozAnQXDe+YvWMxkLFWA+O3TFwkJvdkIK+\/AUSnRssPKt5WHY0FhNOxnSPcLslEL4G4\/RfP95ve99U+kRnDy3X+KtzdQLY+u935ghON\/o3UE4IMv9oN6JX9RnxzL\/LRcOgnHigxStSGPKsZYtnz8RWNVT\/rOLAibqiWJadC5MYHRbekF3eg6FOGrQGkXYbsn0+a5aovnlLCbLwIqY9fcS17UX8J235iQ6cdmHNbrPeS84CMm34RA==&affiliate_id=1052423&strip_google_tagmanager=true\" loading=\"lazy\" data-with-title=\"true\" class=\"fiverr_nga_frame\" frameborder=\"0\" height=\"350\" width=\"100%\" referrerpolicy=\"no-referrer-when-downgrade\" data-mode=\"random_gigs\" onload=\" var frame = this; var script = document.createElement('script'); script.addEventListener('load', function() { window.FW_SDK.register(frame); }); script.setAttribute('src', 'https:\/\/www.fiverr.com\/gig_widgets\/sdk'); document.body.appendChild(script); \" ><\/iframe>\n<br \/><a href=\"https:\/\/www.searchenginejournal.com\/how-to-access-google-analytics-api-via-python\/474458\/\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Google Analytics API provides access to Google Analytics (GA) report data such as pageviews, sessions, traffic source, and bounce rate. The official Google documentation&#8230;<\/p>\n","protected":false},"author":1,"featured_media":27200,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-27199","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech-universe"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Access Google Analytics API Via Python - mailinvest.blog<\/title>\n<meta name=\"description\" content=\"Technology is forever changing, and there are always new pieces of technology to replace obsolete ones. Tons of people enjoy reading tech blogs on a daily basis.mailinvest.blog tracks all the latest consumer technology breakthroughs and shows you what&#039;s new, what matters and how technology can enrich your life. mailinvest.blog also provides the information, tools, and advice that helps when deciding what to buy.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Access Google Analytics API Via Python - mailinvest.blog\" \/>\n<meta property=\"og:description\" content=\"Technology is forever changing, and there are always new pieces of technology to replace obsolete ones. Tons of people enjoy reading tech blogs on a daily basis.mailinvest.blog tracks all the latest consumer technology breakthroughs and shows you what&#039;s new, what matters and how technology can enrich your life. mailinvest.blog also provides the information, tools, and advice that helps when deciding what to buy.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/\" \/>\n<meta property=\"og:site_name\" content=\"mailinvest.blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/freelanceracademic\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-03T10:08:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/mailinvest.blog\/wp-content\/uploads\/2023\/01\/ga-python-63a2ec7fb6662-sej.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1600\" \/>\n\t<meta property=\"og:image:height\" content=\"840\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin@mailinvest.blog\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin@mailinvest.blog\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/index.php\\\/2023\\\/01\\\/03\\\/how-to-access-google-analytics-api-via-python\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/index.php\\\/2023\\\/01\\\/03\\\/how-to-access-google-analytics-api-via-python\\\/\"},\"author\":{\"name\":\"admin@mailinvest.blog\",\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/#\\\/schema\\\/person\\\/012701c4c204d4e4ebd34f926cfd31a4\"},\"headline\":\"How To Access Google Analytics API Via Python\",\"datePublished\":\"2023-01-03T10:08:41+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/index.php\\\/2023\\\/01\\\/03\\\/how-to-access-google-analytics-api-via-python\\\/\"},\"wordCount\":1653,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/index.php\\\/2023\\\/01\\\/03\\\/how-to-access-google-analytics-api-via-python\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/mailinvest.blog\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/ga-python-63a2ec7fb6662-sej.png\",\"articleSection\":[\"Tech Universe\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/mailinvest.blog\\\/index.php\\\/2023\\\/01\\\/03\\\/how-to-access-google-analytics-api-via-python\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/index.php\\\/2023\\\/01\\\/03\\\/how-to-access-google-analytics-api-via-python\\\/\",\"url\":\"https:\\\/\\\/mailinvest.blog\\\/index.php\\\/2023\\\/01\\\/03\\\/how-to-access-google-analytics-api-via-python\\\/\",\"name\":\"How To Access Google Analytics API Via Python - mailinvest.blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/index.php\\\/2023\\\/01\\\/03\\\/how-to-access-google-analytics-api-via-python\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/index.php\\\/2023\\\/01\\\/03\\\/how-to-access-google-analytics-api-via-python\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/mailinvest.blog\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/ga-python-63a2ec7fb6662-sej.png\",\"datePublished\":\"2023-01-03T10:08:41+00:00\",\"description\":\"Technology is forever changing, and there are always new pieces of technology to replace obsolete ones. Tons of people enjoy reading tech blogs on a daily basis.mailinvest.blog tracks all the latest consumer technology breakthroughs and shows you what's new, what matters and how technology can enrich your life. mailinvest.blog also provides the information, tools, and advice that helps when deciding what to buy.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/index.php\\\/2023\\\/01\\\/03\\\/how-to-access-google-analytics-api-via-python\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/mailinvest.blog\\\/index.php\\\/2023\\\/01\\\/03\\\/how-to-access-google-analytics-api-via-python\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/index.php\\\/2023\\\/01\\\/03\\\/how-to-access-google-analytics-api-via-python\\\/#primaryimage\",\"url\":\"https:\\\/\\\/mailinvest.blog\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/ga-python-63a2ec7fb6662-sej.png\",\"contentUrl\":\"https:\\\/\\\/mailinvest.blog\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/ga-python-63a2ec7fb6662-sej.png\",\"width\":1600,\"height\":840},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/index.php\\\/2023\\\/01\\\/03\\\/how-to-access-google-analytics-api-via-python\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/mailinvest.blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Access Google Analytics API Via Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/#website\",\"url\":\"https:\\\/\\\/mailinvest.blog\\\/\",\"name\":\"mailinvest.blog\",\"description\":\"Technology is forever changing, and there are always new pieces of technology to replace obsolete ones. Tons of people enjoy reading tech blogs on a daily basis. mailinvest.blog tracks all the latest consumer technology breakthroughs and shows you what&#039;s new, what matters and how technology can enrich your life. mailinvest.blog also provides the information, tools, and advice that helps when deciding what to buy.\",\"publisher\":{\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/mailinvest.blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/#organization\",\"name\":\"mailinvest\",\"url\":\"https:\\\/\\\/mailinvest.blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/mailinvest.blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/default.png\",\"contentUrl\":\"https:\\\/\\\/mailinvest.blog\\\/wp-content\\\/uploads\\\/2022\\\/01\\\/default.png\",\"width\":1000,\"height\":1000,\"caption\":\"mailinvest\"},\"image\":{\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/freelanceracademic\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mailinvest.blog\\\/#\\\/schema\\\/person\\\/012701c4c204d4e4ebd34f926cfd31a4\",\"name\":\"admin@mailinvest.blog\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/98ed217bd0f3d6a6dcae2d9b0c76e305b049a07275e315e1407e19ec8b08e139?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/98ed217bd0f3d6a6dcae2d9b0c76e305b049a07275e315e1407e19ec8b08e139?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/98ed217bd0f3d6a6dcae2d9b0c76e305b049a07275e315e1407e19ec8b08e139?s=96&d=mm&r=g\",\"caption\":\"admin@mailinvest.blog\"},\"sameAs\":[\"https:\\\/\\\/mailinvest.blog\",\"admin@mailinvest.blog\"],\"url\":\"https:\\\/\\\/mailinvest.blog\\\/index.php\\\/author\\\/adminmailinvest-blog\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Access Google Analytics API Via Python - mailinvest.blog","description":"Technology is forever changing, and there are always new pieces of technology to replace obsolete ones. Tons of people enjoy reading tech blogs on a daily basis.mailinvest.blog tracks all the latest consumer technology breakthroughs and shows you what's new, what matters and how technology can enrich your life. mailinvest.blog also provides the information, tools, and advice that helps when deciding what to buy.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/","og_locale":"en_US","og_type":"article","og_title":"How To Access Google Analytics API Via Python - mailinvest.blog","og_description":"Technology is forever changing, and there are always new pieces of technology to replace obsolete ones. Tons of people enjoy reading tech blogs on a daily basis.mailinvest.blog tracks all the latest consumer technology breakthroughs and shows you what's new, what matters and how technology can enrich your life. mailinvest.blog also provides the information, tools, and advice that helps when deciding what to buy.","og_url":"https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/","og_site_name":"mailinvest.blog","article_publisher":"https:\/\/www.facebook.com\/freelanceracademic\/","article_published_time":"2023-01-03T10:08:41+00:00","og_image":[{"width":1600,"height":840,"url":"https:\/\/mailinvest.blog\/wp-content\/uploads\/2023\/01\/ga-python-63a2ec7fb6662-sej.png","type":"image\/png"}],"author":"admin@mailinvest.blog","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin@mailinvest.blog","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/#article","isPartOf":{"@id":"https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/"},"author":{"name":"admin@mailinvest.blog","@id":"https:\/\/mailinvest.blog\/#\/schema\/person\/012701c4c204d4e4ebd34f926cfd31a4"},"headline":"How To Access Google Analytics API Via Python","datePublished":"2023-01-03T10:08:41+00:00","mainEntityOfPage":{"@id":"https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/"},"wordCount":1653,"commentCount":0,"publisher":{"@id":"https:\/\/mailinvest.blog\/#organization"},"image":{"@id":"https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/#primaryimage"},"thumbnailUrl":"https:\/\/mailinvest.blog\/wp-content\/uploads\/2023\/01\/ga-python-63a2ec7fb6662-sej.png","articleSection":["Tech Universe"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/","url":"https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/","name":"How To Access Google Analytics API Via Python - mailinvest.blog","isPartOf":{"@id":"https:\/\/mailinvest.blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/#primaryimage"},"image":{"@id":"https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/#primaryimage"},"thumbnailUrl":"https:\/\/mailinvest.blog\/wp-content\/uploads\/2023\/01\/ga-python-63a2ec7fb6662-sej.png","datePublished":"2023-01-03T10:08:41+00:00","description":"Technology is forever changing, and there are always new pieces of technology to replace obsolete ones. Tons of people enjoy reading tech blogs on a daily basis.mailinvest.blog tracks all the latest consumer technology breakthroughs and shows you what's new, what matters and how technology can enrich your life. mailinvest.blog also provides the information, tools, and advice that helps when deciding what to buy.","breadcrumb":{"@id":"https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/#primaryimage","url":"https:\/\/mailinvest.blog\/wp-content\/uploads\/2023\/01\/ga-python-63a2ec7fb6662-sej.png","contentUrl":"https:\/\/mailinvest.blog\/wp-content\/uploads\/2023\/01\/ga-python-63a2ec7fb6662-sej.png","width":1600,"height":840},{"@type":"BreadcrumbList","@id":"https:\/\/mailinvest.blog\/index.php\/2023\/01\/03\/how-to-access-google-analytics-api-via-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/mailinvest.blog\/"},{"@type":"ListItem","position":2,"name":"How To Access Google Analytics API Via Python"}]},{"@type":"WebSite","@id":"https:\/\/mailinvest.blog\/#website","url":"https:\/\/mailinvest.blog\/","name":"mailinvest.blog","description":"Technology is forever changing, and there are always new pieces of technology to replace obsolete ones. Tons of people enjoy reading tech blogs on a daily basis. mailinvest.blog tracks all the latest consumer technology breakthroughs and shows you what&#039;s new, what matters and how technology can enrich your life. mailinvest.blog also provides the information, tools, and advice that helps when deciding what to buy.","publisher":{"@id":"https:\/\/mailinvest.blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/mailinvest.blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/mailinvest.blog\/#organization","name":"mailinvest","url":"https:\/\/mailinvest.blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/mailinvest.blog\/#\/schema\/logo\/image\/","url":"https:\/\/mailinvest.blog\/wp-content\/uploads\/2022\/01\/default.png","contentUrl":"https:\/\/mailinvest.blog\/wp-content\/uploads\/2022\/01\/default.png","width":1000,"height":1000,"caption":"mailinvest"},"image":{"@id":"https:\/\/mailinvest.blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/freelanceracademic\/"]},{"@type":"Person","@id":"https:\/\/mailinvest.blog\/#\/schema\/person\/012701c4c204d4e4ebd34f926cfd31a4","name":"admin@mailinvest.blog","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/98ed217bd0f3d6a6dcae2d9b0c76e305b049a07275e315e1407e19ec8b08e139?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/98ed217bd0f3d6a6dcae2d9b0c76e305b049a07275e315e1407e19ec8b08e139?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/98ed217bd0f3d6a6dcae2d9b0c76e305b049a07275e315e1407e19ec8b08e139?s=96&d=mm&r=g","caption":"admin@mailinvest.blog"},"sameAs":["https:\/\/mailinvest.blog","admin@mailinvest.blog"],"url":"https:\/\/mailinvest.blog\/index.php\/author\/adminmailinvest-blog\/"}]}},"_links":{"self":[{"href":"https:\/\/mailinvest.blog\/index.php\/wp-json\/wp\/v2\/posts\/27199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mailinvest.blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mailinvest.blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mailinvest.blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mailinvest.blog\/index.php\/wp-json\/wp\/v2\/comments?post=27199"}],"version-history":[{"count":0,"href":"https:\/\/mailinvest.blog\/index.php\/wp-json\/wp\/v2\/posts\/27199\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mailinvest.blog\/index.php\/wp-json\/wp\/v2\/media\/27200"}],"wp:attachment":[{"href":"https:\/\/mailinvest.blog\/index.php\/wp-json\/wp\/v2\/media?parent=27199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mailinvest.blog\/index.php\/wp-json\/wp\/v2\/categories?post=27199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mailinvest.blog\/index.php\/wp-json\/wp\/v2\/tags?post=27199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}