Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/SukkaW/cloudflare-workers-async-google-analytics
:cloud: The Cloudflare Workers implementation of an async Google Analytics
https://github.com/SukkaW/cloudflare-workers-async-google-analytics
cloudflare cloudflare-workers google-analytics
Last synced: 12 days ago
JSON representation
:cloud: The Cloudflare Workers implementation of an async Google Analytics
- Host: GitHub
- URL: https://github.com/SukkaW/cloudflare-workers-async-google-analytics
- Owner: SukkaW
- License: mit
- Created: 2019-08-05T11:16:08.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-01-26T10:08:46.000Z (almost 3 years ago)
- Last Synced: 2024-04-25T04:02:40.892Z (7 months ago)
- Topics: cloudflare, cloudflare-workers, google-analytics
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 218
- Watchers: 4
- Forks: 32
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cloudflare-workers-async-google-analytics
[![Author Sukka](https://img.shields.io/badge/author-Sukka-b68469.svg?style=flat-square)](https://skk.moe)
[![License MIT](https://img.shields.io/github/license/sukkaw/cloudflare-workers-async-google-analytics.svg?style=flat-square)](./LICENSE)
![NPM Version](https://img.shields.io/npm/v/cfga?style=flat-square)
[![Build with Cloudflare Workers](https://img.shields.io/badge/build%20with-cloudflare%20workers-f38020.svg?style=flat-square)](https://workers.cloudflare.com/)
![Gzip size of cfga.min.js](https://img.badgesize.io/sukkaw/cloudflare-workers-async-google-analytics/master/cfga.min.js.svg?compression=gzip&style=flat-square)
[![](https://data.jsdelivr.com/v1/package/npm/cfga/badge)](https://www.jsdelivr.com/package/npm/cfga)The Cloudflare Workers implementation of an async Google Analytics
## Introduction
This project is based on [Google Analytics Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/v1/), using [Cloudflare Workers](https://workers.cloudflare.com/) with a less than 1KB gzipped tiny `cfga.min.js` to accelerate the Google Analytics, rather than a heavy (45KB gzipped) `analytics.js` from Google.
## Get Start
### 1. Import into Cloudflare Workers
Login into Cloudflare Dashboard and enter `Workers` App. Create a new script, delete default code in the editor, and then copy [the `woker.js` content](https://github.com/SukkaW/cloudflare-workers-async-google-analytics/blob/master/worker.js) into the editor. After saving the workers script, do not forget to register a route for the scripts.
Now you can test your workers with a simple HTTP request. You should able to see `403 Forbidden`. Then you can deploy the scripts.
### 2. Insert the `cfga.min.js` into your website
Just add those few lines of the code to your website, right before `