Skip to main content
  1. Posts/

Strip the URL params before sharing

·2 mins

TLDR; I built a bookmarklet to strip away the tracking parameters in the google search URLs for sharing. Drag the below button and use it, it will generate the current search URL with just the search query, stripping away the additional parameters. Drag it to your bookmark and use it on google search results page.

Strip and share

Annoying URL Params #

https://www.google.com/search?q=boba&client=firefox-b-d&biw=1440&bih=762&ei=jI5vY83HAujYz7sP2va2-Aw&ved=0aUKEwjNveHGz6j7AhVo7HMBHVq7Dc8sdf4dUDCA4&uact=5&oq=boba&gs_lcp=Cgxnd3Mtd2l6LXNlcnAQAzIKCC4QgwEQsQMQQzIECAAQ QzIECAAQQzIECC4QQzIECAAQQzIECAAQQzIFCAAQgAQyBAgAE2edBQgAEIAEMgUIABCABDoKC AAQRxDWBBCwAzoHCAAQsAMQQzoNCAAQ5AIQ1gQQsAMYAToMCC4QyAMQsAMQQxgCOg8ILhDUAhDIAx CwAxBDGAI6DQguEIMBELEDEENKBAhNGAFKBAhBGABKBAhGGAFQ4wJY8ANgpgVoAnABeACAAWGIAb4B kgEBMpgBAKABAcgBE8ABAdoBBggsdfwAEYCdoBBggCEAEYCA&sclient=gws-wiz-serp

We all have seen those ugly Google search URLs, sometimes in a forum post, or through DMs. That’s a self-containing tracking package of who you are (maybe not personally, but your unique ID approximation), where you’re searching from, your browsing history before you landed on that particular search page, and so on.

The query above is a search I performed just now. The query is just “boba”, but it probably has much more than “boba”. It shows that I searched from Firefox, the timestamp, the client (If it were mobile, it would show the device information), and more that only for google’s knowledge.

So, now when I share this URL, Google can pick the trail and follow the next person and from them to the next and so on. Standalone, this is mostly meaningless information and just one more data point out of millions Google already tracks. I have long accepted the futility of trying to escape Google’s tracking, so this is not such a save.

It clutters the UI of wherever I’m pasting it. And my biggest gripe with these kinds of URLs is they obfuscate the search query behind them. I have to squint to see what exactly someone has shared. I almost always read what the ?q is and type it out myself.

There’s also the revealing nature of these URLs. I’ve seen in some forum threads, where in the moment of discussion people put up search results that have the device and location information attached to them.

Hence this bookmarklet. I’m planning to add more sites as and when I can. Maybe Amazon next.

Cleaned up code of the bookmarklet above #

function getParameterByName(name) {
    var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
    return match && match[1];
}

if (window.location.hostname.split('.').slice(0, 2).join('.') == 'www.google') {
  window.prompt("Copy", "https://www.google.com/search?q=" + getParameterByName('q'));
}

It’s also on GitHub - https://github.com/avinoth/strip-and-share