Greasemonkeyin’ Around With Google Cookies

Mph directed me to the awesome Dive Into Greasemonkey by Mark Pilgrim. In no time I had whipped together a Greasemonkey script which anonymizes your google cookie using the same method as the bookmarklet at

Give it a try if you run Firefox and Greasemonkey.

UPDATE: this seems to hose gmail.

UPDATE: putting gmail on the ‘exclude’ list fixed that hoseage. The copy at the above link is now fixed.

UPDATE: Milly himherself points out some possible problems with this script and some suggestions on directions to go with it, in the comments below. Caveat installor.

8 thoughts on “Greasemonkeyin’ Around With Google Cookies”

  1. Nice idea :)

    But your “Greasemonkey script” link above also goes to Mark Pilgrim’s site. I guess it should be to one of these? :-

    I don’t use Firefox, so I’m not sure, but I think it won’t work on country-specific search pages. And my guess is that it may sometimes also hose the other Google services such as Google Answers, Google Web APIs, (posting to) Google Groups, and My Search History.

    The interaction between them all is complicated, and (only) some Google services do a hash to check the validity of the GUID, and sometimes only if the “Remember me on this computer” box is checked. See here for a little more on that theme :-

    The bookmarklet is likely to cause the least trouble, because the idea is you click it once while on a Google search page, so it ‘aims’ at that cookie. And whilst it would also match some non-search services, it doesn’t tend to be used (actually clicked) whilst at such services, so it won’t bother a non-search site and a non-search service won’t bother the pre-existing zeroed GUID unless it really needs to (re the hash check).

    And the regex included is intended to match country domains for search pages.

    But the Greasemonkey script (if I’m understanding it right) has the effect of using it each time it hits one of the ‘include’ sites, except the ‘exclude’ sites. That seems likely both to use it when it needn’t or shouldn’t (unless you expand the list of ‘excludes’ to specify some other services), and unhelpfully not use it when at other country-specific search sites (because your ‘include’ list is only .com, not, .ca, etc, and that overrides, I think the regex).

    I’m sorry I have only problems, not solutions, but my JS knowledge (in bookmarklets or greasemonkey) isn’t up to much :(

    BTW, if you want a feature suggestion, which would suit a greasemonkey script more than a bookmarklet? You might consider reading the current cookie, while on a Google page, and displaying it discreetly at the top of the page. So you could always see whether your current GUID is zeroed, or personalised. The ShowCookie bookmarklet here might be a helpful starting point :-

    Sorry you started? ;)

    If you didn’t want to make a career of this, perhaps adding a To Do/Wishlist section to the script comments would test if you and I are the only people in the world interested in this …


  2. Wow. I had no idea what I was getting into. Thanks for the comments, Milly.

    I’ll make a note of them in the script itself and consider writing a “always show my GUID when on Google’s pages” one instead. I think that would honestly be more useful.

  3. You’re welcome, and I didn’t realise what I was getting into either ;)

    (Herself, btw. Here in the UK, Milly is an almost exclusively female name).


  4. I’ve modified your script and added it to

    I’ve also tested my script with GMail and several other Google Account services. No problems at all. Therefore I choose not to exclude GMail. The cookie check for /^PREF=/ should be sufficient. GMail cookies should not be affected.

  5. Woot, man! I’m much happier to have it be a part of the Google UberScript than in my clumsy hands. I’m thrilled to have contributed.

    Now if only there were a smilar engine for Safari…

  6. Actually, I was hoping to have exactly what you’d done (and was thinking about doing it from the same source myself). I don’t want all the extra stuff that offers (at least right now) and if I generate the CG script with only the anon option checked I still get a huge script.

    I’m just starting out with GreasMonkey, and I want the scripts I use to be ones I can easily parse within a couple of minutes, so the CustomizeGoogle output is more than I’m interested in (not that it’s not great, just not for me). I’ll just have to hack it together myself.

    I you purposefully removed the script from your site, you might want to go to and disable the link.

  7. Oh, sorry, that wasn’t purposeful; I inadvertently deleted it when I updated wordpress on this site. It’s back.

Comments are closed.