Use this documentation to add your custom Javascript script and or execute PHP code on WooCommerce Thank You page.
You can write any custom PHP code before line number 30.
Or add your JavaScript (JS) on line number 32.
Your script may require order detail parameters and you can use parameters in the code to pass to your JS script.
See the snippet:
You can place the above code in active theme functions.php file or use Code Snippet plugin.
If required more complex need, contact your developer