Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
A lightweight replacement for GoatCounter's counter
Diet Goat is a modern and minimal alternative for GoatCounter's count.js
. If you use it correctly, it will easily replace the official script in 99% of the use cases. However, it can't do everything.
Unlike the official count.js, Diet Goat
URL
and URLSearchParams
)sendBeacon()
[data-goatcounter-settings]
, providing these defaults:
no_onload
is true
no_events
is false
allow_local
is false
allow_frame
is false
#toggle-goatcounter
With all these limitations, Diet Goat is around 500 bytes when minified and brotli'ed, which is more than 3x smaller than the official script.
As mentioned previously, Diet Goat is an ESM-only script without any automatic counting. To use it, import it in a module script and run count()
:
<script type="module">
import { count } from "https://cdn.jsdelivr.net/npm/diet-goat@3/+esm";
count("https://yourdomain.goatcounter.com");
</script>
[!NOTE] The major version of Diet Goat will match the major version of the official script. There are no versions 2 and 3.
By calling the method inside <script type="module">
, it will execute after the page loads, so you do not have to worry about DOMContentLoaded
any more.
If you want to re-define the re-definable parameters (path, title, or referrer) or mark the visit as an event, you can add a second parameter:
<script type="module">
import { count } from "https://cdn.jsdelivr.net/npm/diet-goat@3/+esm";
count("https://yourdomain.goatcounter.com", {
p: "/", // count everything as if it's an index page
});
querySelector("button#like").addEventListener("click", () => {
count("https://yourdomain.goatcounter.com", {
p: "Like button slapped",
e: true,
});
});
</script>
© 2023 Nikita Karamov
Licensed under the ISC License.
Based on the original count.js
, version 3.
© 2021–2023 Martin Tournoij
Licensed under the ISC License.
This project is hosted on GitHub: https://github.com/kytta/diet-goat.git
FAQs
A lightweight replacement for GoatCounter's counter
The npm package diet-goat receives a total of 2 weekly downloads. As such, diet-goat popularity was classified as not popular.
We found that diet-goat 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.