Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Readme
The Cloudflare Workers implementation of an async Google Analytics
This project is based on Google Analytics Measurement Protocol, using Cloudflare Workers 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.
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 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.
cfga.min.js
into your websiteJust add those few lines of the code to your website, right before </body>
. Do not forget to replace the default configuration with your own!
<script>
window.ga_tid = "UA-XXXXX-Y"; // {String} The trackerID of your site.
window.ga_url = "https://example.com/xxx/"; // {String} The route of your cloudflare workers you just registered before.
</script>
<script src="https://cdn.jsdelivr.net/npm/cfga@1.0.0" async></script>
Releases Only
.Click the watch
button at the top of the repo and choose Releases Only
, so you can get notice of release update in time.
cfga.min.js
collected and sentCurrently, cloudflare-workers-async-google-analytics
and cfga.min.js
only support collect those types of data listed below. If you want to collect more, you should use Google Analytics official track code.
dl
: Document location URLuip
: User real IPua
: User Agentdt
: Document Titlede
: Document Encodingdr
: Document Referrerul
: User Languagesd
: Screen Colors Depthsr
: Screen Resolutionplt
: Page Load Timedns
: DNS Timepdt
: Page Downloaad Timerrt
: Redirect Response Timetcp
: TCP Connect Timesrt
: Server Response Timedit
: DOM Interactive Timeclt
: Content Load Timecloudflare-workers-async-google-analytics
blocks those types of request by default:
User-Agent
in request headersReferer
in request headersAnd if you want to restrict your workers only for your website, all you need to do is to edit a few lines of your workers:
//const AllowedReferrer = 'skk.moe';
skk.moe
, then remove //
.Notice: set
AllowedReferrer
value toskk.moe
means all the subdomains ofskk.moe
will be allowed as well.
cloudflare-workers-async-google-analytics © Sukka, Released under the MIT License.
Authored and maintained by Sukka with help from contributors (list).
Personal Website · Blog · GitHub @SukkaW · Telegram Channel @SukkaChannel · Twitter @isukkaw · Keybase @sukka
FAQs
The Cloudflare Workers implementation of an async Google Analytics
We found that cfga demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).