Last active
June 13, 2023 05:33
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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