Minimal versions of popular analytics libraries. Reduce the impact of third-party scripts on your application.

Overview

minimal-analytics

This project aims to provide minimal implementations of popular analytics libraries. It's aimed at users who want to reduce the impact of third-party JavaScript on their project, without losing core analytics data. If you require more advance tracking, it's recommended to use the official library instead.

Getting Started

Depending on your preferred service, visit the relevant package below and follow setup instructions:

Library Package
GA4 @minimal-analytics/ga4
Comments
  • Add a note about what options to toggle in GA4

    Add a note about what options to toggle in GA4

    Hi. While this might seem obvious to others, could you kindly add a note in the readme file about what options users need to toggle in their GA4 property? (I think pageview, scroll and search?). Perhaps as a new paragraph just before or after the "Getting Started" heading.

    documentation question ga4 
    opened by rbn30117 11
  • Not tracking downloads through form submit

    Not tracking downloads through form submit

    Hello!

    We have a form, to enforce captcha and/or CSRF tokens on download. However, this library doesn't track those as downloads - even though they do result in a download, and the link the form submits to ends in a supported file ext.

    Is this intended behavior, or a missing feature?

    ga4 
    opened by androidacy-user 8
  • gtag() compatibility

    gtag() compatibility

    Hello!

    We'd like to start using this library for GA4 on our site(s), but we're hitting a big snag right now: having to restructure all of our tracking calls to use mostly custom code.

    Is there a plan to add gtag() or even dataLayer compatibility in the future?

    enhancement ga4 
    opened by androidacy-user 8
  • Not measuring engagement time

    Not measuring engagement time

    I created a new GA4 instance but the CDN code is not recording the average engagement time anymore. https://prnt.sc/mckg9ky5d20j

    Edit: I compared my previous GA4 instance and I found there is a greater discrepancy in engagement time between the two instances with regards to average engagement time. The previous one (which I used with the early versions of GA4 code you made) shows everything as I would expect (e.g reading time of 3 minutes), but the latest code has lots of erratic instances like 00 seconds or at most 9 seconds for similar posts.

    bug ga4 
    opened by rbn30117 7
  • How to use the code

    How to use the code

    Hi. I installed node.js and run the command you provided.

    1. Is the index.js file the complete code I should copy to my site?
    2. How do I add GA4 tracking ID?
    3. My site is based on Hugo if it matters.
    4. I am a JS noob, let alone typescript. So, kindly bear with me
    documentation question ga4 
    opened by sifigi4335 7
  • Minimal Analytics are getting blocked by Ad Blockers + Firefox Private Mode

    Minimal Analytics are getting blocked by Ad Blockers + Firefox Private Mode

    Thank you @jahilldev,

    I have created the Analytic Endpoint, but still, the Firefox Private Mode browser is not working.

    Here is my website: https://charbelnemnom.com

    You access it via Firefox Private Mode and then open the web developer tool, then click on Network. Yes, you will see a Warning message on the page, but you can disregard it.

    Refresh the page and then you can see POST: blog.charbelnemnom.com/collect is blocked.

    If we look at the Headers, we can see the following:

    Status: 302 Found: VersionHTTP/3 Transferred: 885 B (0 B size) Referrer Policy: strict-origin-when-cross-origin Request Priority: Lowest

    If I access it from a normal browser, I can see real-time data so the endpoint that I created is working.

    I checked https://dariusz.wieckiewicz.org/ with Firefox Private Mode, and he was able to bypass the Ad blocking mode:

    Status: 204 No Content: VersionHTTP/2 Transferred: 652 B (0 B size) Referrer Policy: strict-origin-when-cross-origin Request Priority: Lowest

    More details here: https://dariusz.wieckiewicz.org/en/minimal-google-analytics-4-snippet/#minimal-analytics-4---masking-hiding-requests

    However, I am not using https://www.netlify.com/, (https://docs.netlify.com/routing/redirects/redirect-options/#query-parameters), so I cannot configure this 200 status code,

    I am redirecting with 302 status with Cloudflare Workers.

    https://blog.charbelnemnom.com/collect ==> https://www.google-analytics.com/g/collect

    Any help is highly appreciated.

    Many Thanks!!!

    question ga4 
    opened by CharbelNemnom 6
  • Customize analytics endpoint

    Customize analytics endpoint

    I would like to reverse proxy calls to the GA server through my own domain using a Cloudflare worker in order to prevent ad blockers from blocking the request, so I would appreciate if you could add the ability to customize analyticsEndpoint. Thanks!

    enhancement ga4 
    opened by marshmallowcreme 6
  • Using jsDelivr?

    Using jsDelivr?

    Using the Hugo method I told you about which imports the CDN file automatically during build, sometimes the build fails due to timeout when trying to fetch the file. Is there a way to have the code hosted on jsDelivr too or any other CDN?

    question ga4 
    opened by rbn30117 4
  • feat: added download attr support for non anchor click elements

    feat: added download attr support for non anchor click elements

    Although not strictly valid syntax, having the ability to indicate elements other than <a /> as download triggers is very useful from an analytics point of view.

    The following elements can now trigger a download event by applying the relevant attribute (download, see here) with a respective value:

    • <a /> (pre existing)
    • <button /> (must have value for download)
    • <input /> (only types of submit and button, must have value for attribute)

    The following example will correctly trigger a download tracking event for a download triggered by some kind of server led system:

    <form>
      <input type="submit" value="Download" download="https://path.com/to/my/file.pdf" />
    </form>
    
    enhancement ga4 
    opened by jahilldev 0
  • chore: updated jsdelivr cdn url

    chore: updated jsdelivr cdn url

    The curred JSDelivr CDN url is cached for up to 12hrs at the server level, but also set max-age for up to 7 days. This can cause a user to cache the file for up to a week.

    This is problematic in case of bug fixes, or if a user of the package wants to make use of a new feature.

    We've now switched the url to use a version less format, which should provide the latest version instantly.

    enhancement ga4 
    opened by jahilldev 0
  • feat: added global window definition for ease of use

    feat: added global window definition for ease of use

    Currently if a consumer does not make use of Node, or a build tool built in Node, it's not possible to access the track function globally inside an applications code.

    This introduces an additional config property, defineGlobal, that can be set to handle this definition. You can access the function by calling:

    window.track(/*[...]*/);
    
    enhancement ga4 
    opened by jahilldev 0
Owner
James Hill
Technical Lead @groupon 💚. Performance advocate ⏱️. Generally pleasant fellow.
James Hill
Calculating Pi number without limitation until 10k digits or more in your browser powered by JS without any third party library!

PI Calculator Web JS (Online) Calculating Pi number without limitation until 10k digits or more in your browser powered by JS without any third party

Max Base 6 Jul 27, 2022
Quickly check your websites for third party requests.

Third Party Checker Tool for crawling websites and checking for third party requests using Puppeteer. Installation git clone https://github.com/pxlrbt

Dennis Koch 7 Nov 1, 2022
The high-impact (popular) packages of npm

npm-high-impact The high-impact (popular) packages of npm. Contents What is this? When should I use this? Install Use API npmHighImpact npmTopDependen

Titus 26 Dec 21, 2022
Userscript developed by Stay & Third Party userscript available on Stay.

Stay offical userscript Get the userscript manager Stay² Developed by Stay Name Description Link 知乎@AutoExpand 自动展开回答,支持知乎桌面版 Get Google@PreventAppJum

shen yin 72 Nov 15, 2022
A tiny cross-platform client for SQLite3, with precompiled binaries as the only third-party dependencies.

Tiny SQLite3 A tiny cross-platform client for SQLite3, with precompiled binaries as the only third-party dependencies. A nice feature about this modul

Fabio Spampinato 19 Oct 27, 2022
A wrapper for valorant-api, a third-party API for getting data within Valorant. Available on npm

valorant-wrapper A wrapper for the third-party valorant-api How to Use All endpoints can be accessed off the ValAPI class. import { ValAPI } from 'val

Aircraft Overviewer 5 Nov 7, 2022
A third-party VALORANT API wrapper library.

wrapper-valorant-api A NodeJS wrapper for the VALORANT API. Installation npm: npm i wrapper-valorant-api yarn: yarn add wrapper-valorant-api VAL-CONTE

LordPrinz 3 Dec 8, 2022
Next-gen mobile first analytics server (think Mixpanel, Google Analytics) with built-in encryption supporting HTTP2 and gRPC. Node.js, headless, API-only, horizontally scaleable.

Introduction to Awacs Next-gen behavior analysis server (think Mixpanel, Google Analytics) with built-in encryption supporting HTTP2 and gRPC. Node.js

Socketkit 52 Dec 19, 2022
A collection of scripts to build offline documentation for your favourite frameworks/libraries. Simply search, copy/paste the commands and enjoy.

Offline-docs A collection of scripts to build offline documentation for your favourite frameworks/libraries. Simply search, copy/paste the commands an

Naveen Namani 37 Dec 24, 2022
🐧 [WIP] Genshin Impact Chat Bot

Genshin Bot Config $ cp config/bot.sample.ts config/bot.ts Development $ yarn $ yarn dev $ open http://localhost:7001/ Npm Scripts Use yarn lint to ch

CanisMinor 2 Dec 20, 2021
A unofficial Node.js library for HoYoWiki API, can get the details of Genshin Impact items!

HoYoWiki API (Node.js Library) English | 繁體中文 | 简体中文 A unofficial Node.js library for HoYoWiki API, can get the details of Genshin Impact items! Repor

張文相 Wenxiang Zhang (旋風之音 GoneTone) 5 Jul 17, 2022
Jonathan Parker 6 Nov 23, 2022
This project is written in JavaScript with minimal npm scripts and commands

This is an Educational repository, for learning how to install and implement the Webpack, Webpack-CLI and the Webpack-dev-server for a project. This project is written in Javascript with minimal npm scripts and commands. It is a minimal implementation of a To Do list application.

John Omachi 7 Sep 23, 2022
Reduce misspelled email addresses in your web apps.

mailcheck.js The Javascript library and jQuery plugin that suggests a right domain when your users misspell it in an email address. mailcheck.js is pa

mailcheck 7.9k Dec 28, 2022
A Javascript based web application for monitoring, analytics and notifications

JELLYWATCH Jellywatch is a javascript web application for monitoring*, analytics** and notifications** inspired by tautulli for Jellyfin/Emby Media Se

null 27 Dec 28, 2022
Fallback for SVG images by automatically creating PNG versions on-the-fly

SVGMagic - Cross browser SVG This repository is no longer actively mainted. It has proven to be very usefull back in 2013, but these days SVGs are sup

Dirk Groenen 596 Jul 27, 2022
caniuse.com but for PHP - a searchable list of new and deprecated features in recent PHP versions

caniphp.com caniphp.com is like caniuse.com but for PHP features. It's a simple search of PHP features that added, deprecated and removed in recent ve

Ross Wintle 95 Dec 25, 2022
🪵 Aggressively find a packages changelog (or releases) between versions.

?? changelogd Aggressively find a packages changelog (or releases) between versions. Status: Early Access Please report any issues ?? Made possible by

Harlan Wilton 8 May 10, 2022
A full documentation on everything we know about Alpha 1.0.16 versions.

Minecraft's Alpha 1.0.16 Versions Before you start, make sure to watch RetroGamingNow's video about this first. Highly influenced (technically a port

_NexTre_ 44 Dec 23, 2022