Reputation: 757
I am trying to embed the google analytics initialization call into an AWS Lambda function. I'm getting the exception ReferenceError: window is not defined
which makes sense seeing as there isn't a browser window. Is there a way to initialize the script so I can make ga()
calls in AWS Lambda?
Thanks!
Upvotes: 0
Views: 2314
Reputation: 5288
I think you're using the wrong SDK. That initialisation is for the web app, which is meant to run on the front-end with access to window
. Instead, use the Google Analytics Measurement Protocol.
Upvotes: 5