If you want your script to be ready and loaded before the page loads, you have to place it in the head tag. If you want the script to be available right before the user encounters something on the page you can put it in between the <body> and </body>.
If your script does some enhancements or provides some tracking information place it before the </body> tag.
Want to be a full stack developer? Check out the full stack developer course from Intellipaat.