Skip to content

javaadpatel/google-analytics-serverless

Repository files navigation

Serverless Function for Google Analytics

Netlify Status

Deploy to Netlify

A simple serverless function, using Express.js, that retrieves Google Analytics Page View results, and can be deployed to Netlify.

The solution is inspired by this Netlify blog post.

The app is hosted at /.netlify/functions/server. Examples of how to access the Express.js endpoints:

* curl https://netlify-express.netlify.com/.netlify/functions/server/getViews

* curl https://netlify-express.netlify.com/.netlify/functions/server/getViewsByPagePath?pagePath=/securing-traefik-dashboard-with-azure-ad/

Running locally

In order to run locally, rename the file .env.bak to .env and fill in the required secrets, which you can obtain by following this blog post.

Deploying to Netlify

You can use the Netlify Deployment button to deploy the function to your Netlify account. After deploying your function you will need to set the environment variables so that the function works correctly.

About

Serverless function for retrieving google analytics page view data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published