The Basic Guide to Run Squoosh Locally

Published:

This guide helps you set up Squoosh on Windows 10—a proprietary operating system with lots of malicious functionalities—and remove Google Analytics.

Motive

Squoosh is released to the public under a free software license which is Apache License, Version 2.0. This means anybody can run, copy, distribute, study, change, and improve it. This also means I am allowed to change it and run it locally.

For privacy, I believe using Squoosh on a local machine is better than using it through squoosh.app. Although uBlock Origin can block Google Analytics, there is probably server logging or server-side tracking.

Prerequisite

I use Node version 18.18.0 and NPM version 10.5.2. If you use a different version, you may find a problem.

You need to understand about classes, functions, and variables in JavaScript.

Running Squoosh locally

First, download Squoosh source code from GitHub: GoogleChromeLabs/squoosh.

Then, run npm install. (I ignore all the npm audit commands.)

If you try running npm run build, you will get an error about colors.css. To fix this issue, follow the instructions on DEVTomatoCake's comment on "Error: Could not load css," issue number 1204, on GitHub.

Once you fix the issue, execute npm run build and npm run serve. Now, you should be able to run Squoosh locally.

Removing Google Analytics

Remove Google Analytics by following these steps:

  1. Turn off the local server.
  2. Open src/client/initial-app/index.tsx.
  3. Remove all the analytics code. (The analytics code is below the main().)
  4. Open src/shared/prerendered-app/intro/index.tsx.
  5. Search for // Send the analytics data comment.
  6. Remove the gaEventInfo variable and the ga function.
  7. Remove the rest of the ga functions and the associated variables.
  8. Open src/client/lazy-app/Compress/Results/index.tsx
  9. Remove all the ga functions and the associated variables.
  10. Remove private onDownload property.
  11. Search for onClick={this.onDownload}.
  12. Remove the onClick attribute.

Removing UTM parameters

Remove all the (Urchin Tracking Module) UTM parameters because they are useless. To do that, follow these steps:

  1. Open src/static-build/index.tsx.
  2. Remove all the UTM parameters. (Do not remove the forward slash. Just remove everything after it.)

Finishing

Run the local server. If you do not face any problems, great.

Now, you can run Squoosh in the proprietary operating system without being tracked by Google.