If you’ve ever worked with Google Analytics API, you are probably familiar with the Query Explorer. What many users don’t know about is that Google also has a similar tool called Request Composer.
The main difference between the two is that while Query Explorer is built on top of Reporting API v3 the Request Composer has v4 under the hood.
The v3 of Reporting API is still perfectly supported by Google but they recommend using v4 for all new developments, this is also what Google itself claims to be doing. They also have a very detailed guide for migrating from v3 to v4.
But before you start migrating, let’s use Google Analytics Request Composer to see what’s new in v4 (there are some pretty neat new features).
Here’s a quick overview of the new features in v4
- Metric expressionsThe API allows you to request not only built-in metrics but also a combination of metrics expressed in mathematical operations. For example, you can use the expression
ga:goal1completions/ga:sessionsto request the goal completions per number of sessions.
- Multiple date rangesThe API allows you in a single request to get data in two date ranges.
- Cohorts and Lifetime valueThe API has a rich vocabulary to request Cohort and Lifetime value reports.
- Multiple segmentsThe API enables you to get multiple segments in a single request.
Google Analytics Request Composer
Just like Query Explorer, Request Composer also lets you play around with Google Analytics Reporting API. Super useful whenever working with the API. If you haven’t tried Query Explorer yet, I recommend you check it out first. This way you can get a better overview of what each of the tools is good for.
So, now that you know that the Query Explorer lets you run queries against your Google Analytics account, including all the metrics and dimensions available in the GUI as well as the filters and segments, let’s see why they had to build another tool.
One of the features the Reporting API v4 introduced is requesting histograms straight from the API. Let’s take a closer look.
- Histogram dimension
As you can see, with the Histogram Query you can define custom buckets. In our example, we divided 24 hours into 6 equal buckets. For more detailed information about the histogram buckets, take a look at this page.
Another useful feature exclusively available in the Reporting API v4 is Pivot Request.
- pivot metrics
- pivot dimensions
Pivot Query in Reporting API v4 is a super useful feature and we managed to find a few good insights just by playing with it in the Request Composer. Go ahead, see what you can find from your data.
A cohort is a group of users who share a common characteristic. For example, all users with the same Acquisition Date belong to the same cohort. The cohort analysis report lets you isolate and analyze cohort behavior.
While this feature is still in beta and you can only choose cohorts based on the acquisition date, some users already say it’s the single most useful feature of Google Analytics.
- cohort metrics
- cohort size
While acquisition date based cohorts are useful, I personally can’t wait for this feature to allow creating cohorts based on other dimensions, such as device category and custom dimensions.
A metric expression is a mathematical expression you define on existing metrics; it operates like a dynamic calculated metric. You can also define aliases to represent the metric expressions.
- metric expressions
Just like with other new features the v4 API introduced, making calculations with metrics was possible before but required some extra coding. Having the ability to do it on the query level makes things both faster and clearer.
While Google Analytics Reporting API v3 is still more popular than its successor, the new feature can really make a difference. I definitely recommend you explore what v4 has to offer and Request Composer is by far the best option for getting started.
Let us know in the comments below what are your thoughts on both v4 and Request Composer, should you have any questions just post them, too.