It depends on the configuration:
when you use a theme and you put the script in the header, if you have to update the theme, it will overwrite the header and the tracking code with it.
If you use the plugin, this will not be a concern.
👉🏼 So if you are not using a theme you can put it in the header but it should be avoided with a theme.