How can I fully install Google Tag Manager on my website?

I need to install Google Tag Manager on my website, but I’m having issues with the checkout. When I place the Google Tag Manager tag in the theme.liquid, it works on the website but not in the checkout. How can I install Google Tag Manager so that it works on the entire site?