DEV Community

Shashwat Deep
Shashwat Deep

Posted on

Those ugly tracking codes in your links? I’m building a one-click fix (while learning JavaScript from scratch)

I have been an avid privacy advocate for quite some time now. It started with outright rejecting all "Big Brother" tech, and being hyper paranoid with every little detail, willing to sacrifice ease of use, in exchange for added privacy. However, as time went on, I slowly understood what is that I actually consider my "threat model", and what exactly is my "sweet spot" between privacy and ease-of-use.

I'm now back on multiple "Big Brother" tech, with some extra steps, to ensure I get the facilities they provide, while also being wary of my data.

However, while I did make this compromise, I was very annoyed I had to make this compromise in the first place. In an ideal world, I would want the tech where everyone actually is, and is the standard for that particular domain, to have privacy features by default, and not be treated as a niche, or a luxury you have to go out of your way to avail. It was this annoyed version of myself, with my strong belief of privacy features and tools being the new norm, I started looking at everything with that lens.

And that is how I got concerned about tracking in links and URLs.

Try sharing any Instagram post, or YouTube video, by copying its URL, and you will see a bunch of garbage (garbage to you) in the link. Take for example this (fake) link:

https://www.instagram.com/p/Cxyz123/?igshid=AbCdEf123456

These links contain something along the lines of utm_* (marketing attribution), or in this case, Ad-Click Identifiers, such as fbclid (Meta), gclid (Google), or igshid (Instagram). These pesky trackers help collect information regarding you, your device, and also help connect you across the internet, mapping your movement as you browse the web.

The thing is, while there are good Samaritans who have built tools and websites to get rid of these trackers, and many privacy oriented browsers have introduced a "Copy Clean Link" option while copying the link from the browser, I believe there should be a tool which should not be restricted to a browser, or a particular application, but provide a system wide option to copy clean links, regardless of where you are copying it from. And that tool should not be restricted to a particular operating system or type of device. Copying on WhatsApp should have a "Copy Clean Link" option, not because WhatsApp mandates it, but because the device itself has a system wide tool, which brings that option across all applications.

Well, that's the long-term destination, but here's what actually ships this month.

I will obviously start small, with a tiny scope, and keep building on that to achieve this "norm" I want to be normalized. Which is why v1 is where you right-click a link in Firefox, a menu item says "Copy clean link", you click it, the link lands on your clipboard with utm_*, fbclid, gclid, and igshid stripped out. Real parameters (?q=privacy), or #fragment and the path survive. Zero host permissions required, and completely unable to read the pages you visit.

Why exactly such a small scope? Well, because I do not exactly know how to write in JavaScript YET (emphasis on that word). So I'm taking inspiration from swyx's "Learn in Public" (https://swyx.io/learn-in-public) and learn, build, and publish what I built, with notes on what I learnt.

So, well, here is the GRAND PLAN:

  • Week 1: learn enough JavaScript to write the function that spots a tracking parameter
  • Week 2: a working extension skeleton: right-click a link, the menu item appears
  • Week 3: it actually cleans links, and it's submitted to Firefox's add-on store
  • Week 4: rewrite in TypeScript.

So, if any of this interests you: I publish every Sunday. Follow and tag along with me during the journey.

To see the code grow, here is the repo: https://github.com/shashwat-deep/URL-Tracking-Parameter-Stripper

Top comments (0)