Posts

Showing posts with the label Analytics

Grab Google Analytics Data in remote account from Firebase Functions

Image
Although Google analytics Login is isolated from other Google services, you can easily access the analytics data from another service.  I am going to demonstrate how to retrieve google analytics data from firebase functions. You need to use googleAPI node package as an assistant. In coding, you have to use  JWT authentication in order to avoid async await issue in Google Cloud functions. Currently stable version of cloud functions is Nodejs 6. You have to download the service-account.json from Firebase or google cloud. In firebase, it is located at the following link. You have to generate a new private key. https://console.firebase.google.com/u/0/project/<project-id>/settings/serviceaccounts/adminsdk Make sure it contains the client email. That email need to be added in Analytics >>admin >> User Management Section as a user. https://analytics.google.com/analytics/web/ The code block in the batchGet fuctions will execute in firebase functions no