Open kaycebasques opened 5 years ago
function doGet() { const args = { id: 'ga:186332065', start: '2018-12-06', end: 'today', metrics: 'ga:totalEvents', options: { 'dimensions': 'ga:eventLabel' } }; const data = Analytics.Data.Ga.get( args.id, args.start, args.end, args.metrics, args.options ); data.rows.forEach(function (row) { Logger.log(row); }); const output = ContentService.createTextOutput(); output.setMimeType(ContentService.MimeType.JSON); output.setContent(JSON.stringify({message:"fuck yeah!"})); return output; }
Cover all of the UI bullshit that you have to do to get this working.
"Using Google Apps Script To Publicly Expose Some Google Analytics Data As JSON"