https://github.com/connormckelvey/cloudflare-pixel-worker
Cloudflare Woker for javascript-free page view analytics
https://github.com/connormckelvey/cloudflare-pixel-worker
cloudflare-workers google-analytics serverless
Last synced: 12 months ago
JSON representation
Cloudflare Woker for javascript-free page view analytics
- Host: GitHub
- URL: https://github.com/connormckelvey/cloudflare-pixel-worker
- Owner: connormckelvey
- License: mit
- Created: 2022-02-06T02:32:47.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-02-06T02:33:37.000Z (about 4 years ago)
- Last Synced: 2025-02-16T09:14:43.116Z (about 1 year ago)
- Topics: cloudflare-workers, google-analytics, serverless
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cloudflare Pixel Worker
Cloudflare Pixel Worker is an example (not a library) of how use a Cloudflare Worker with an analytics provider such as Google Analytics. It is essentially a port of [Google Analytics Beacon](https://github.com/igrigorik/ga-beacon), written in Javascript and targeting Cloudflare.
## Use Cases
Some websites/platforms allow users to publish HTML, but not Javascript. Some sites support integrations with the user's Google Analytics account, but some, like in my case (a popular online marketplace for physical goods) do not. This leaves content authors, creators, and other businesses at the mecry of the platform to provide (often limited) traffic insights.
## Usage
### Requirements
- [Wrangler](https://developers.cloudflare.com/workers/cli-wrangler)
- Nodejs + npm
### Configuration
- configure the wrangler.toml file for your Cloudflare site, worker name, and route
- configure the ./config/ga_client.json file with your Google Analytics UA Code `UA-XXXXXXXXX-X`
### Deploy
`wrangler publish`
## Contributing
I don't really see this turning into a versioned library or module of any kind. PRs are are welcome for code clarity, related examples, and documentation.