Need help listening for a callback function. Don't know where to place it and how to retrieve data (e.g. Cookiebot OnAccept)

Hello guys,

I am using Cookiebot for cookie banner purposes. Everything of this logic is handled within Google Tag Manager and Cookiebot itself but I would like to retrieve some more information. The Cookiebot script has callback functions in place like CookiebotCallback_OnAccept or CookiebotCallback_OnDecline that I would like to utilize. A simple script like

<script>
function CookiebotCallback_OnAccept() {
  console.log("user accepted cookies");
} 
</script>

works fine inside the console so the event is fired.

My questions are:
Where should I place this code to listen for this callback?
How can I save this (or any other return statement) to the DB?
How to utilize the toolbox plugin?

Thanks for any hint!