Page is still loading

Riimu's Cookie Clicker Optimizer

Optimizer external API

In order to prevent abuse and unintended usage of the website, some of the features on the website take usage of CSRF tokens to prevent requests from external sites. However, there are still legitimate reasons to post into the optimizer from extenal sites. This page lists ways to interact with the website from other sources.

Importing saves from external locations

To import saves from external locations, such as by adding a button to the cookie clicker itself, you should use the following url:

http://cookie.riimu.net/api/import/

The save data should be provided in a POST variable called 'save_data'. Additionally, if you don't want the save data to be stored in the optimizer database as part of your imported saves, you can add the parameter 'nosave=1' after the url. For example:

http://cookie.riimu.net/api/import/?nosave=1

Below is an example code that can be run in your browsers console to add a button to the Cookie Clicker's Menu to export a save directly to the optimizer

function sendToOptimizer(){var el=document.getElementById("saveToExport");el.value=Game.WriteSave(1);return true}(function(){var oldMenu=Game.UpdateMenu;Game.UpdateMenu=function(){oldMenu();if(Game.onMenu=="prefs"){l("menu").innerHTML=l("menu").innerHTML.replace('<div style="padding-bottom:128px;"></div>','<div class="title">Export</div><div class="listing"><form method="post" action="http://cookie.riimu.net/api/import/" target="optimizer"><input type="hidden" id="saveToExport" name="save_data" /><input class="option" type="submit" onclick="return sendToOptimizer();" value="Upload to Optimizer" /></form></div><div style="padding-bottom:128px;"></div>')}}})();

Additional features

If you need a feature that hasn't been implemented or have creative ideas about how to use this optimizer, feel free to add your suggestions to the issue tracker.