Google Analytics is a popular tool for analyzing web traffic. It helps website owners to know more about the people who visit their site. With Google Analytics, website owners can know the location of the individuals who visit their site, the devices they use, the web pages they visit most, the buttons they click most, etc. This way, it’s possible to know more about the website and make any necessary changes.
APIs enable us to create interfaces between two program modules. APIs also facilitate the exchange of data between applications. Google Analytics supports the use of APIs. With the use of these APIs, you can access information about your Google Analytics account. You can also use the APIs to access the core reporting data. In this article, we will be discussing the Google API Analytics in detail.
Prerequisites
This is what you need for this article:
- An Active Google Analytics Account.
Understanding Google API Analytics
Every application depends on another program to perform particular functions. A good example of such a program is an API (Application Programming Interface). Most applications support the integration with other applications by the use of an API.
If you need to use the functionality that is provided by Google Analytics, you should write a program that will interact with Google API Analytics.
Google Analytics has two types of APIs:
- Management API.
- Core Reporting API.
The management API enables you to access information about your Google Analytics account, views, and web properties. However, you cannot access the actual reporting data with this API.
To access the actual reporting data from Google Analytics like pageviews, sessions, and bounce rate, you have to use the Core Reporting API.
The following are some of the tasks that you can perform with Google API Analytics:
- Querying and managing dozens of analytics websites/properties at once.
- Merging Google Analytics data with the other data sources.
- Retrieving data in the way you want.
- Scheduling Google Analytics exports to BigQuery, Excel, etc.
- Automating the creation of reports and dashboards.
- Eliminating or reducing data sampling via query partitioning.
- Simplifying data extraction, integration, and creation of visualizations.
- Automating the importation of cost data into Google Analytics.
You can indirectly access the Management and the Core Reporting APIs without writing a single code via the online software offered by Google Analytics. Every time you access any of the Google Analytics reports, you indirectly use Google API Analytics.
However, if your goal is to access the Google API Analytics directly, like accessing the Google Analytics data directly into your spreadsheet, you should write some code that makes a request to the Google API Analytics.
However, it’s not easy to write code that accesses the Google API Analytics. Lucky enough, there are many third-party tools that you can use to interact with the Google API Analytics directly and without writing a single line of code.
Working with Google Analytics APIs
In this section, I will be showing you how to access the Google API Analytics using the Google Analyticspreadsheet add-on. For you to use this add-on, you must be familiar with the following:
- Google Analytics Account Explorer.
- Core Reporting API Filters.
- Google Analytics Dimensions and Metrics Explorer.
- Core Reporting API Dimensions and Metrics.
- Google Analytics Query Explorer.
The Google Analytics Account Explorer helps you to access information about your Google Analytics Account.
The Google Analytics Dimensions and Metrics Explorer lists and explains the metrics and dimensions available via the Core Reporting API. It also shows the metrics and dimensions that can be used/queried together.
The Core Reporting API Dimensions and Metrics help you to access Google Analytics using the API name of a dimension/segment/metric instead of using the web view name.
The Core Reporting API Filters helps you to apply filters and get meaningful data when using the Core Reporting API.
The Google Analytics Query Explorer helps you to create and execute queries so as to access Google Analytics via the Core Reporting API.
If you are familiar with the above tools, you are good to start using the Google Analyticspreadsheet add-on.
You can use this add-on to access the Google Analytics data directly using the core reporting API and transfer the data into a Google Spreadsheet. Follow the steps given below:
Step 1: First, install the Google Analyticspreadsheet add-on. Just open a new Google spreadsheet and click the “Add-ons” menu. Choose “Get addons”.
Search for the “Google Analytics add-on” and click the “Install” button to install it.
Step 2: Once installed, you will be able to see it under the “Add-ons” menu.
Click the “Create new report” sub-menu showed above.
Step 3: The “create a new report” window will be opened. Configure the report as shown below:
Note that you should select the metrics and dimensions based on the Google Analytics report that you need to generate.
Step 4: Click the “Create Report” button. This will generate a new report as shown below:
A keen look at the report shows that some of the fields are empty. You can get data for these fields from the Query Explorer. Change the value of “ga:goalXXValue” to “ga:goal4Value”.
Step 5: Again, click the “Add-ons” menu, select “Google Analytics” and then click the “Run reports” sub-menu.
If there are no parameters with errors, you will get a success message.
You will also see a new tab for the report at the bottom.
The data in the generated report will match the data contained in your Google Analytics report. Thus, you’ve successfully downloaded data from Google Analytics into Google Sheets using the Google Analyticspreadsheet add-on.
Limitations of Google API Analytics
The following are the challenges involved when using the Google API Analytics:
- Complexity. The Google API Analytics are complex to use and it may take a longer time to learn how to use them.
- Technical expertise may be needed. This is due to the complexity of the Google API Analytics. In some cases, one may have to write some code so as to use the APIs.
- Real-time data access. Users face challenges whenever there is a need to access Google Analytics data in real-time using the Google API Analytics.
Conclusion
This is what you’ve learned in this article: You’ve learned more about Google API Analytics and you’ve learned how to access Google API Analytics using the Google Analytics spreadsheet add-on.
Integrating and analyzing your data from a huge set of diverse sources can be challenging, this is where Hevo comes into the picture. Hevo is a No-code Data Pipeline and has awesome 150+ pre-built integrations that you can choose from. Hevo can help you integrate your data from numerous sources and load them into a destination to analyze real-time data with a BI tool and create your Dashboards. It will make your life easier and make data migration hassle-free. It is user-friendly, reliable, and secure. Check out the pricing details here. Try Hevo by signing up for a 14-day free trial and see the difference!
Let us know what you think in the comments below!
Nicholas Samuel is a technical writing specialist with a passion for data, having more than 14+ years of experience in the field. With his skills in data analysis, data visualization, and business intelligence, he has delivered over 200 blogs. In his early years as a systems software developer at Airtel Kenya, he developed applications, using Java, Android platform, and web applications with PHP. He also performed Oracle database backups, recovery operations, and performance tuning. Nicholas was also involved in projects that demanded in-depth knowledge of Unix system administration, specifically with HP-UX servers. Through his writing, he intends to share the hands-on experience he gained to make the lives of data practitioners better.