1. Home
  2. Knowledge Base
  3. Google Analytics
  4. How to Use the Unsampled Reports API (Analytics 360 customers only)

Requesting Unsampled Data from Google Analytics Using The Unsampled Reports API

You will need a trial license key or a Premium subscription to use the features discussed in this tutorial.  If you haven’t already done so, sign-up for a free 30-day trial and instantly get your license key so you can begin.

If you are an existing customer, contact support@analyticscanvas.com to request a free 30-day trial of the Premium subscription. 

You can download unsampled reports generated by Analytics Canvas or those defined within the Google Analytics web interface. To create the report within Analytics Canvas:

  1. Open Analytics Canvas and apply your license key (you only need to do this once)
  2. Go to New Source > Google Analytics and choose Create Unsampled Report

 

creating an unsampled report with Analytics Canvas

 

  • This is...If this is your first time using Canvas, it will ask you to authorize a connection to Google Analytics. The authorization is between your machine and the Google Analytics APIs. Your tokens are not accessible by us and we cannot access your data.  

Note: You must permit both read and write access, and you must include permissions for either Google Drive or Google Cloud Storage. This is because Google writes the data to files, which must be stored, then accessed from within Canvas. Don’t worry, Canvas does this all programmatically. 

 

Image
  1. You will only be shown a list of Analytics 360 accounts and views that you can select from. Select the View you wish to query from and click Next. 
  2. The Unsampled Reports API has a limit of 4 dimensions and 10 metrics per query.
  3. Make your query by selecting your dimensions and metrics.Complete your query by selecting the Time Period, applying existing segments or defining a new one, applying filters, and including any metadata to be included in your extract.
  4. Unsampled reports may take a very long time (from many minutes to hours) to complete. Often, while building a canvas and defining all queries, you may not wish to send many requests, but rather use the core API as a preview, then run the canvas and send requests when ready. If you wish to request unsampled data right away, check the checkbox labeled “Send unsampled report request on OK”, and as soon as the block is created a request will be made.

 

Data flow for unsampled reports

Unsampled reports follow a four-step process:

  1. The query is defined, and a preview is shown using the Core reporting API.  This preview data may be sampled. This step is useful to let you modify the query, and the date range before you send the request for the unsampled data. 
  2. Once the query is ready, the data set is requested via the unsampled API and the report is marked "Pending" and a unique id is assigned.
  3. When the report is ready, a CSV file is created on the users Google Drive
  4. The file is downloaded using the Google Drive API by Analytics Canvas and made available in the import block.

Analytics canvas automates this entire process.

When you are using Analytics canvas, you will see the following Icons to indicate what stage each query is in:

Query defined but not yet requested from the unsampled API:

Image

Request to the unsampled API is pending:

Image

Request to the unsampled API is pending:

Image

Unsampled report is complete and downloaded:

Image

Viewing unsampled reports statuses

If you go to the API Management menu, you will find a selection "Google Analytics Premium Unsampled reports".

Image

If you have unsampled reports defined in the current canvas there will be a tab "Reports in this Canvas" that shows all the unsampled reports that are referenced in the current canvas, and their status.

Image

If there are reports that have not yet been requested, the request(s) can be made either by pressing "Send request for all required reports" or by checking the reports you wish to send requests for and then pressing "Send request for checked reports".

If there are reports that are completed, and not yet downloaded, pressing "Download data for all completed reports" will run the canvas and fetch all data sets from Google Analytics.

Even if there are not any unsampled reports in the current canvas, the "All analytics canvas created reports" tab and a "web requested reports" tab will be present, and this provides a complete listing of all recently requested unsampled reports and their status for any selected profile.   

Reports requested by Analytics Canvas will include full details of dimensions and metrics;

 

Image

Web requested reports will show the current status:

Image

Selecting this will allow you to request a list of all the recent outstanding reports requested and their status by clicking on a profile.      

It is also possible to directly insert the data into the current canvas by selecting a query, and pressing the "import onto canvas" button.

Your Unsampled data can now be exported to Excel, Tableau, Sheets, or your database.

Again, be aware of the Unsampled Reports API limits. You can only include 4 dimensions and 10 metrics, it will return up to 3 Million rows per query (no limit on sessions), and you can make up to 500 new reports per project, per day, to a maximum of 3500 unsampled reports.    

It is best used when partitioning doesn’t work, your resource quota is exhausted or your query contains more than 100M sessions, and your data is not in BigQuery.  

Happy Analyzing!

 

Was this article helpful?

Related Tutorials/Video