In order to use Anubis in any of the ways described here, you need to embed its (909 byte) script in the <head> section of your web page:
<script src="https://anubis.zehuti.com/embed" data-anubis="your-public-key"></script>
You can choose your implementation method below:
Well, almost no code - once you've set up your account, you just replace your form's action target with your no-code URL and let Anubis do the work - it'll redirect your form back to its intended target once the user passes the challenge.
Alternatively, it can send a callback to a different URL and redirect the user without the form data, but more on that later.
<form action="https://anubis.zehuti.com/nocode/nocode-key" method="post">
If you're happy with creating server-side code, you can add Anubis to an existing form using the onsubmit event. Anubis will stop the form being sent until the challenge has been completed, then add a result to test server-side in a field called _anubis.
<form onsubmit="return anubis(this)">
Alternatively, if you're creating a more complex JS web app, you can trigger Anubis by passing it a success and fail function that will be called with the result. Anubis works asychronously, so unless you have a really specific use-case, the callback is the simplest way to achieve what you need.
anubis(success, fail);
You can have Anubis return a promise with a script like this, which calls yourfunction with the string to test via your back end:
anubis().then(yourfunction).catch(errorfunction);
Alternatively, you can use Anubis with an await if async is your cup of Joe. This script calls yourfunction with the string to test via your back-end:
yourfunction(await anubis());
This is the part you need to carry out server-side, as not only do you use your private key, but performing this in the browser makes the whole process irrelevant. Anubis doesn't enable cross-site scripting on the response end-point for precisely this reason.
Importantly, test the response twice; you'll notice it fails the second time, as the response has expired. There's an important lesson there.