Google aims to make its Google Analytics API as simple to use as possible and so towards that effect it has released two more features that make it even easier to use.
Relative Dates
All MCF Reporting and Core API queries earlier required a start and an end date. In the earlier version users had to tell the App what today’s date was and then input the date for 14 days and only then could they see the data.
To make things easier for users Google has recently added support for relative dates. From now on users can specify ‘X’ days ago as a value for either the end date or start date. This effectively means that users can now express dates as:
Start – date=15daysAgo&end – date=yesterday
This will automatically determine the date range and data will be displayed for the last fortnight or whatever time period you enter.
Sample size control
You can also sample data in certain circumstances. Google has added a few new features that will allow you to easily modify setting and obtain reports of the sample.
First, Google has included a new query parameter that allows you to set the level of sampling. From now on developers are at liberty to obtain samples that are either quick or precise.
Second, two more features are added to the API response:
- sampleSize – The number of samples that are used for a sample query
- sampleSpace – The sampling space size. This indicates from what available sample space size the samples were selected.
With these additional features, users can compute the percentage of visits that were used for a query. For example if the sample Size = 95000 and sampleSpace = 100000, then the report is based on 95% of total visits. This gives developers a good idea of the amount of data that was used for calculating the sample.
Getting started on these two features is easy. A reference guide on these features is available which you can access and make the necessary changes to begin using these features.