Todd, Welcome. You’ll need to look through the templates and see how they are constructed. If the person who built the site used layouts, embeds, or partials for the head section, then you may only have to update one location. Otherwise, you’ll just need to find where they added the
<head> sections. Start with the template docs to understand how they work: https://docs.expressionengine.com/latest/templates/overview.html .
A couple other good resources would be Justin’s article on understanding templates from his Intro to EE course: https://u.expressionengine.com/course/introduction-to-building-an-expressionengine-site/templating-intro-templates-template-groups-staying-dry, and Doug’s Templating lesson if video is more your thing from his Intro to EE video course: https://u.expressionengine.com/course/getting-started-with-expressionengine-video-course/getting-started-with-expressionengine-using-file-fields-part-2-templating. hope that helps.
You may need to protect site visitors by only including Googles surveillance code behind a consent if it leaks any personal information to Google (hint - it nearly always does). EE has a full consent mechanism built in, see https://docs.expressionengine.com/latest/add-ons/consent.html#consent - this will give visitors the option whether to allow surveillance or not, and is required if visiting the site from the EU.
Consent is quite technical to set up, if you can’t do it yourself I’d recommend seeking some assistance.
Go to your EE control panel and create a template variable (or upload it through your favorite IDE editor).
Let’s say you call it “google-tags”. Insert your Google HTML or JS code inside.
Then go to your template pages and put the variable in the headers:
The code will now be displayed on every page, and you can update it in one single place if you require it in the future.
Now to second what Rob mentioned, be aware of privacy issues. If this is a business or commercial sites, it’s not very user-friendly to transfer visitors/customers data to a third party like Google without their consent.
Second of all, third-party analytics are very much useless today.
You might mention this to your customer. The stats will be very broken because tons of users use ad blockers today and most browsers have build in some tracking protection.
That means almost all Google code is already blocked. If this is a site towards geek or technology users, it’s even worst. Your analytics will miss a huge amount of traffic.
Your best option is to do analytics on the server side without leaking it to a third party. A local solution like Piwik, Webalizer, Open Analytics or something else should do the trick, and you can get full analytics of people hitting your server.
Using your local logs might be harder to set up once, but it’s faster (you are not using a third-party code to load from another server…), it’s private (data stays in your server, and you control it) and it’s more precise (it will log all traffic).