Skip to content

An alternative to Google Analytics for websites and extensions ​

Google Analytics is the default for a reason: it is free, capable and familiar. Many developers look for an alternative when they meet one of its consequences: a consent banner on their website, a hard time adding it to a browser extension, or simply more data than they want to hold. This article sets out how Google Analytics 4 works, from Google's own documentation, and what a privacy-respecting alternative does differently, so you can judge which fits your product.

How Google Analytics 4 works on a website ​

It sets cookies ​

On a website, Google Analytics 4 sets first-party cookies to recognise visitors: _ga, "used to distinguish users", and _ga_<container-id>, "used to persist session state". Each expires after two years by default (Google: cookie usage on websites).

Those cookies are what let it count returning visitors and sessions. They are also, in the European Union, information stored on the visitor's device, which is why sites using it there commonly ask for consent first.

Google provides consent mode to adjust its tags to the visitor's choice. In basic consent mode, tags are blocked until consent is given and "no data is transferred to Google at all". In advanced consent mode, tags load and, when consent is denied, they do not read or write analytics cookies, but "measurements without cookies are sent" (Google: consent mode overview).

So with consent mode you choose between not measuring people who decline, and sending Google limited measurements about them.

IP addresses and retention ​

Google states that in Google Analytics 4 "IP addresses are not logged or stored" (Google: IP masking).

User-level data, meaning data tied to cookies, user IDs and advertising identifiers, is kept for 2 or 14 months, as you choose. The retention setting "only affects explorations and funnel reports"; standard aggregated reports are unaffected (Google: data retention).

How Google Analytics 4 works in a browser extension ​

The usual website tag cannot be used in an extension. Chrome's own guide to using Google Analytics 4 in an extension explains that "since Manifest V3, Chrome Extensions are not allowed to execute remotely hosted code", which rules out the standard gtag.js library. Instead it uses the Measurement Protocol, which "lets you send events directly to Google Analytics servers with HTTP requests" (Chrome: use Google Analytics 4).

In practice that means writing the integration yourself:

  • generating a client_id and keeping it in extension storage so it stays the same while the extension is installed;
  • tracking sessions yourself, in session storage, ending them after 30 minutes without events;
  • building and sending each request from your own code.

It works, and it is your code to maintain, including queueing events across service worker restarts. Uninstalls, Firefox's built-in consent and the stores' privacy forms are left to you.

What a privacy-respecting alternative does differently ​

A privacy-respecting tool starts from different defaults:

  • No cookies. Returning visitors are recognised, if at all, by a random identifier scoped to your site or extension, or are not tracked across visits.
  • No personal data by design. No user IDs, no advertising identifiers, nothing that follows people to other sites, and the IP address used for a country at most, then dropped.
  • Shorter, simpler disclosures. Less collected means fewer boxes on a store's form and a shorter privacy notice.
  • Built for the use you have. For extensions in particular, a bundled library that handles the service worker, uninstalls and Firefox's consent, instead of an integration you write.

It also gives things up, and it is fair to say which:

  • No advertising integration. Data that does not follow people cannot build advertising audiences.
  • Fewer reports. Funnels across devices, user-level explorations and demographic reports depend on the data a privacy-respecting tool does not collect.
  • Consent is not automatically gone. On a website, anything stored on the visitor's device can still fall under Europe's rules; see Analytics without cookies: what changes and what does not.

Which should you use? ​

  • Choose Google Analytics if you run advertising and need it measured in the same place, if you need user-level explorations, or if your team already depends on its reports.
  • Choose a privacy-respecting tool if you need product questions answered (usage, retention, sources), want to collect as little as possible, or are measuring a browser extension and would rather not build and maintain the integration yourself.

Some teams use both: Google Analytics for marketing pages that run advertising, and a privacy-respecting tool inside the product.

Common questions ​

Will my numbers match Google Analytics? ​

No, and they should not be expected to. The tools identify visitors differently, treat consent differently and filter bots differently. Run both for a few weeks and compare trends: if both show the same growth and the same busy days, both are measuring the same reality.

Can I bring my Google Analytics history with me? ​

History rarely moves between analytics tools in a useful way, because each defines visitors and sessions differently. Keep your old reports, or an export of them, for comparison, and start the new tool's history from the day you switch.

Is Google Analytics free? ​

The standard Google Analytics 4 is free. A paid tier, Google Analytics 360, offers longer retention for event data, up to 50 months according to Google's data retention page.

Do I need to remove Google Analytics to add an alternative? ​

No. Some teams keep it on marketing pages that run advertising and use an alternative inside the product. Each tool you keep is another set of disclosures, so keep only what you use.

Does the extension approach work in Firefox too? ​

The Measurement Protocol is plain HTTP, so the same code can send from a Firefox extension. What Chrome's guide does not cover is Firefox's built-in consent: usage data falls under technicalAndInteraction, which must be optional, so your integration has to read the user's choice before every send and send nothing when it is declined. See Passing Firefox add-on review with analytics.

How AnalyticsTrend does it ​

AnalyticsTrend is product analytics for browser extensions and websites. It sets no cookies on the people it measures, does not fingerprint, and collects no personal data unless you put it in an event property. On websites it records the referring hostname, campaign parameters and page paths; in extensions it is a bundled package for Manifest V3 with a stored queue, uninstall tracking that works on Firefox, and Firefox's consent honoured. The IP address becomes a country, and in some countries a region, then is discarded; raw events are kept 90 days and daily totals after that, hosted in Canada.

What it collects is in What it collects. To try it, see Install on a website or Install in a Chrome extension. For a broader comparison of any tools, use How to choose an analytics tool.


Facts about Google Analytics checked against Google's documentation on 7 October 2026. Google changes its products; check the linked pages for the current behaviour.

Data hosted in Canada. No cookies, no fingerprinting, no personal data. IP Geolocation by DB-IP.