What is TamperMonkey? And When Do I Use It?

tampermonkey_script_overviewTamperMonkey is a Google Chrome (and Opera and Chromium) plugin similar to GreaseMonkey for Firefox. It allows you to inject additional JavaScript into web pages you load in your browser, adding features, removing features, or in our case doing hacky, automated things.

For example, want to get more likes through the norm of reciprocity, but don’t want to have to bother actually clicking “like” on everything?  You can use a TamperMonkey script to randomly like content in a realistic, human manner.

TamperMonkey gives you access to pretty much everything you could get by writing a custom Chrome plugin, but this way you can easily manage and edit the scripts in one interface rather than needing to create and edit separate plugins.

tamperfireYou can also access hundreds of already written user scripts via the TamperFire option in TamperMonkey, which lets you access TamperMonkey compatible GreaseMonkey scripts from the site UserScripts.org.

Just search for the site you want a script for and see which scripts are available.  As you’ll see in this screen shot for “facebook.com” scripts, most do minor cosmetic or functional one-trick pony things.

The major limitation of TamperMonkey is that it is not meant for website automation and thus you can’t (in a stateful manner) really write a script that loads X page clicks a button, which loads Y page and clicks another button, then loads Z page and fills out a form.  This is critical to complex automation, where you need knowledge of what you did on X page when you get to Y page.  In some cases, with dynamic web 2.0 sites which never unload the DOM tree and just update portions of it, you can automate things with TamperMonkey.

So, understand that TamperMonkey is just one tool, very useful at what it’s very good at.  For other situations you need other tools, one such being iMacros.

iMacros for Chrome or Firefox is like TamperMonkey on steroids, and it includes ways to do stateful work and do things like easily write scraped data to the file system.  People have developed a large volume of useful hacky scripts for iMacros, particularly in the Blackhat SEO community.  Personally I hate the syntax of iMacros, it’s yet another language I need to remember and be proficient in, and the great thing about sticking with JavaScript for automation is that I find I can re-use the snippets very easily across different projects in a way I can’t with iMacros since its code only works in iMacros.

One comment