google-analytics-proxy
v4.0.1
Published
Google Analytics setup to bypass firewalls and blockers
Downloads
9
Readme
Google Analytics Proxy
Cloudflare Workers script to bypass firewalls and blockers for Google Analytics.
Server
The proxy server is a Cloudflare Workers script.
Develop
npm run develop-server
Build
npm run build-server
Deploy
Deploys to workers.dev
npm run deploy-server
Client
An example client is provided in src/client
.
The client uses analytics.js with a custom sendHitTask to send data to the proxy server. The client is also setup to track additional custom dimensions with every hit.
Develop
npm run develop-client
Build
npm run build-client
Publish
The client is published as an npm package. To publish, increase version in package.json then
npm publish
Usage
<script async src="https://proxy.domain/analytics.js"></script>
import analytics from "google-analytics-proxy/client";
analytics.init("UA-147724716-1", "https://proxy.domain/collect");
analytics.ga("send", "pageview");
analytics.ga("send", "event", {
eventCategory: "Test",
eventAction: "Click",
hitCallback: () => {},
});