Skip to content

Remove Google Analytics script loader - #213

Open
Hathor875 wants to merge 1 commit into
Euro-Office:mainfrom
Hathor875:remove-ga-loader
Open

Remove Google Analytics script loader#213
Hathor875 wants to merge 1 commit into
Euro-Office:mainfrom
Hathor875:remove-ga-loader

Conversation

@Hathor875

Copy link
Copy Markdown

Remove Google Analytics script loader

Strips the GA script injection from apps/common/Analytics.js. The public API is
retained as no-ops so the existing call sites across the editors keep working;
removing those follows in a separate change.

Refs #82

What changed

  • initialize() no longer appends the inline <script> that seeded _gaq and
    pulled in google-analytics.com/ga.js. Both methods are now empty.
  • The argument validation went with the injection — there is nothing left to
    validate. Callers that passed a bad type used to get a throw; they now get
    silence, which is the intent: no call site should have to care.
  • $('head') was this file's only jQuery dependency, so the module no longer
    touches the DOM or any global beyond window.Common.
  • The license header is untouched.

Why the call sites stay

rg -i analytics apps/ --glob '!vendor' returns ~530 hits across the three
editors. Removing them is mechanical, but folding it into this commit would bury
the handful of lines that actually matter behind a diff nobody can review. The
no-op shims keep every one of those call sites working, so this change stands on
its own and cannot break a build. The call-site cleanup lands separately.

The loader was already dead

initialize() is guarded by && false in each editor's Main.js, so ga.js
was never injected in the first place. This commit removes code that had already
stopped running — it is not a behaviour change for users, only a removal of the
dead path and the third-party URL baked into it.

Relation to #85

#85 does this in full — loader, call sites, canAnalytics flags, build config,
HTML loaders (74 files, +12 −781). It is the better end state and stays open;
I will close this if it lands.

It is not mergeable today: open ~2 months, no review, no CI, and main has moved
165 commits since — including Grunt → webpack. It edits build/appforms.json and
build/Gruntfile.js, which no longer exist, so it cannot be rebased. This change
touches one file for that reason, and removes the part that carries the risk.

Testing

  • node --check apps/common/Analytics.js — clean.
  • Loaded the module in node (global.window = global) and called
    trackEvent() before initialize(), then initialize(), then
    Common.component.Analytics.trackEvent() — no throw, and both aliases still
    resolve to the same object.
  • rg "_gaq" apps/ --glob '!vendor' — no matches.
  • test/unit-tests/common/index.html (per test(unit-tests): make the harness runnable again #194): 12 passing, unchanged. Note
    the harness has no coverage for this file — rg -i analytics test/ is empty —
    so it confirms no regression elsewhere, not that this file works.

Strips the GA script injection from Analytics.js. The public API is
retained as no-ops so the existing call sites across the editors keep
working; removing those follows in a separate change.

Refs Euro-Office#82

Signed-off-by: Krzysztof Cieślik <132496025+Hathor875@users.noreply.github.com>
@Hathor875
Hathor875 requested a review from a team as a code owner August 22, 2026 23:31
@Hathor875
Hathor875 requested review from Alex-Arsys and MonaAghili and removed request for a team August 22, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant