Skip to content

Instantly share code, notes, and snippets.

@allenday
Last active June 13, 2023 05:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allenday/61210f4478848fdbb2e1276adf688413 to your computer and use it in GitHub Desktop.
Save allenday/61210f4478848fdbb2e1276adf688413 to your computer and use it in GitHub Desktop.
Chainlink + Google Analytics - code snippet to fetch dog and cat votes from BigQuery
const requestConfig = {
method: 'post',
headers: {
"Authorization": `Bearer ${accessToken}`,
"Accept": 'application/json',
"Content-Type": 'application/json'
},
data: {
"metrics": [{"name":"activeUsers"}],
"minuteRanges":[{"startMinutesAgo":29,"endMinutesAgo":0}]
}
}
requestConfig.url = `https://analyticsdata.googleapis.com/v1beta/properties/${secrets.property1}:runRealtimeReport`
const request1 = Functions.makeHttpRequest(requestConfig)
requestConfig.url = `https://analyticsdata.googleapis.com/v1beta/properties/${secrets.property2}:runRealtimeReport`
const request2 = Functions.makeHttpRequest(requestConfig)
const responses = await Promise.all([ request1, request2 ])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment