Our goal is for Google Analytics APIs to be as simple to use as possible - so we just released 2 new features that make it even easier to use our APIs.
To make things easier, we’ve added support for relative dates! You can now specify NdaysAgo as a value of either the start or end date. So the date range of the last 14 days from yesterday can now be expressed as:
start-date=15daysAgo&end-date=yesterday
Using these values will automatically determine the date range based on today’s date, allowing apps to always display the data for last 14 days (or whatever time period you’d like!).
Sample size controlIn certain cases, data may be sampled. To simplify setting and reporting the impact of sampling, we’ve added a couple new sampling related features.
Second, we added 2 new fields to the API response:
.Relative dates
All Core API and MCF Reporting API queries previously required a start and end date. In the past, apps that displayed recent data - like the last 14 days - would have to manually determine today’s date, determine when 14 days ago was, and format the dates so they could be used.To make things easier, we’ve added support for relative dates! You can now specify NdaysAgo as a value of either the start or end date. So the date range of the last 14 days from yesterday can now be expressed as:
start-date=15daysAgo&end-date=yesterday
Using these values will automatically determine the date range based on today’s date, allowing apps to always display the data for last 14 days (or whatever time period you’d like!).
Sample size control
First, we added a new query parameter to set the level of sampling. Developers can now specify whether reports should be faster or be more precise.
Second, we added 2 new fields to the API response:
- sampleSize - The number of samples that were used for the sampled query.
- sampleSpace - The total sampling space size. This indicates the total available sample space size from which the samples were selected.
With these 2 values you can calculate the percentage of visits that were used for the query.
For example, if the sampleSize = 201,000 and sampleSpace = 220,000 then the report is based on 91.36% of visits.
Together, these values allow developers to see exactly how much data was used to calculate the sample.
Getting Started
There are two easy ways to get started: you can read our reference guide on the new relative dates feature, or check out our docs on the new sample size control query parameter and sample size API response data. As always, you can stay up to date using our change logs
No comments:
Post a Comment