I just looked at the code of in the Starter theme:
Conclusion: when you add code to the Body (in the HTML Yool) the code is inserted just after the opening tag of the body element and if you add code to the Footer (again in the HTML Tool) the code is inserted just before the closing tag of the body element.
Thanks. I should have mentioned that I’m using the Mercury theme. Either way, I wasn’t sure if I should be editing the theme directly.
I got it to work by putting it in the footer.