Skip to content

Instantly share code, notes, and snippets.

@Abhikumar98
Created May 6, 2020 13:25
Show Gist options
  • Save Abhikumar98/c6487b77def560188e32827ff9f84e88 to your computer and use it in GitHub Desktop.
Save Abhikumar98/c6487b77def560188e32827ff9f84e88 to your computer and use it in GitHub Desktop.
const response = await gapi.client.request<QueryResponse>({
path: "/v4/reports:batchGet",
root: "https://analyticsreporting.googleapis.com/",
method: "POST",
body: {
reportRequests: [
{
viewId: profileId,
dateRanges: [
{
startDate: "30daysAgo",
endDate: "today"
},
{
startDate: "60daysAgo",
endDate: "30daysAgo"
}
],
metrics: [
{
expression: "ga:sessions"
}
],
dimensions: [
{
name: "ga:date"
}
]
}
]
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment