Skip to content

javaadpatel/google-analytics-serverless

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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