1162
page-template-default,page,page-id-1162,theme-pitchwp,qode-core-1.2,woocommerce-no-js,pitch-theme-ver-3.4.2,ajax_leftright,page_not_loaded,smooth_scroll,transparent_content,grid_1300,side_menu_slide_from_right,vertical_menu_with_scroll,woocommerce_installed,blog_installed,columns-3,wpb-js-composer js-comp-ver-6.6.0,vc_responsive
<!DOCTYPE html> <html> <head> <meta charset=”utf-8″> <title>Hello Analytics Reporting API V4</title> <meta name=”google-signin-client_id” content=”276225857746-n992chc5j0396eqncgvqiiugojc6u49d.apps.googleusercontent.com”> <meta name=”google-signin-scope” content=”https://www.googleapis.com/auth/analytics.readonly”> </head> <body> <h1>Hello Analytics Reporting API V4</h1> <!– The Sign-in button. This will run `queryReports()` on success. –> <p class=”g-signin2″ data-onsuccess=”queryReports”></p> <!– The API response will be printed here. –> <textarea cols=”80″ rows=”20″ id=”query-output”></textarea> <script> // Replace with your view ID. var VIEW_ID = ‘<REPLACE_WITH_VIEW_ID>’; // Query the API and print the results to the page. function queryReports() { gapi.client.request({ path: ‘/v4/reports:batchGet’, root: ‘https://analyticsreporting.googleapis.com/’, method: ‘POST’, body: { reportRequests: [ { viewId: VIEW_ID, dateRanges: [ { startDate: ‘7daysAgo’, endDate: ‘today’ } ], metrics: [ { expression: ‘ga:sessions’ } ] } ] } }).then(displayResults, console.error.bind(console)); } function displayResults(response) { var formattedJson = JSON.stringify(response.result, null, 2); document.getElementById(‘query-output’).value = formattedJson; } </script> <!– Load the JavaScript API client and Sign-in library. –> <script src=”https://apis.google.com/js/client:platform.js”></script> </body> </html>