google-analytics-proxy
v4.0.1
Published
Google Analytics setup to bypass firewalls and blockers
Downloads
39
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-serverBuild
npm run build-serverDeploy
Deploys to workers.dev
npm run deploy-serverClient
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-clientBuild
npm run build-clientPublish
The client is published as an npm package. To publish, increase version in package.json then
npm publishUsage
<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: () => {},
});