For php I used this guide: https://cloudpresshosting.co.uk/blog/reporting-wordpress-errors-to-sentry
For JS, I found out I can take the code of the bundle and the initialization and put in the header, using “add scripts to header and footer” plugin. https://wordpress.org/plugins/header-and-footer-scripts
It took me time to notice I can’t put the initialization within the bundle import.
Got something like this:
<script
src="https://browser.sentry-cdn.com/5.20.1/bundle.min.js"
integrity="sha384-O8HdAJg1h8RARFowXd2J/r5fIWuinSBtjhwQoPesfVILeXzGpJxvyY/77OaPPXUo"
crossorigin="anonymous">
</script>
<script>
Sentry.init({ dsn: 'https://unique@unique' });
</script>