-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
I wanted to get data from my google analytics without OAuth and im getting 401 error. Currently i'm passing only API Key (I can't find Simple API Key since the design has changed). Here's my code:
function init() {
gapi.client.setApiKey(apiKey);
window.setTimeout(gapi.client.load('analytics', 'v3', makeApiCall), 1);
}
function makeApiCall() {
gapi.client.analytics.data.ga.get({
'ids': document.getElementById('table-id').value,
'start-date': document.getElementById('start-date').value,
'end-date': document.getElementById('end-date').value,
'metrics': 'ga:visits'
}).execute(handleCoreReportingResults);
}
function handleCoreReportingResults(results) {
if (!results.code) {
console.log('Query Success');
} else {
console.log('There was an error: ' + results.message);
}
}
I also tried to create a Service account but I'm not sure how can I use it here
Metadata
Metadata
Assignees
Labels
No labels