If you have already added your GA4 code to Squarespace, you should remove it before you add in the Google Tag Manager code.

1. First to Add the Google Tag Manager Code – instructions below

2. To remove the Google analytics code – because it will be added inside of Tag Manager, so we don’t need to duplicate) (which is in the “Settings > Developer Tools > External API Keys section”

3. Add Google Tag Manager

On the sidebar click “Settings”, “Advanced”, and “Code Injection” functionality.

Add in the code below

Screenshot

Paste this code in HEADER section:
<!– Google Tag Manager –>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({‘gtm.start’:
new Date().getTime(),event:’gtm.js’});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!=’dataLayer’?’&l=’+l:”;j.async=true;j.src=
‘https://www.googletagmanager.com/gtm.js?id=’+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,’script’,’dataLayer’,’GTM-XXXXXX‘);</script>
<!– End Google Tag Manager –>

2. Paste this code in FOOTER SECTION
<!– Google Tag Manager (noscript) –>
<noscript><iframe src=”https://www.googletagmanager.com/ns.html?id=GTM-XXXXXX
height=”0″ width=”0″ style=”display:none;visibility:hidden”></iframe></noscript>
<!– End Google Tag Manager (noscript) –>

Screenshot