How to Add Google Analytics to a Squarespace Website
Whether you’re building an online store or a news website, or anything in between, you’re going to want to sure you have some software set up to monitor visits and interactions, and Google Analytics is the best of the bunch. You’ll be pleased to hear then that you can add Google Analytics to a Squarespace website. It’s pretty easy to do too, taking no more than a couple of minutes from start to finish.
For the purpose of this article, we’ll assume you have some rudimentary understanding of what Google Analytics is and have researched the difference between Universal Analytics (UA) and Google Analytics 4 (GA4), the two different tracking methods available at the moment. If you haven’t, we recommend going with Universal Analytics when the time comes — it’s the more traditional method.
How to Add Google Analytics to a Squarespace Website
The first thing you’re going to want to do is head over to Google Analytics and create a New Property. To do this, select Admin from the sidebar within Google Analytics, followed by Create Property from the middle column; assign a Property Name (the name of your website will do), and a reporting time zone and currency, then click on Show Advanced Options, and enable Universal Analytics.
If you want to stick with Google Analytics 4, you don’t need to select this option. You also have the choice to create both a Google Analytics 4 and a Universal Analytics property from this view. By default, when clicking enable Universal Analytics, Google will prompt you to set up both. There’s no harm in doing this, but our personal preference is to select Create a Universal Analytics Property Only.
Google will then provide you a couple of different tracking codes. Copy the one entitled Global Site Tag (gtag.js), then head into Squarespace Settings, followed by Advanced, then Code Injection, and Header, and paste the Global Site Tag into the header code section and hit save. Return to the homepage, wait a few seconds, then ensure that the session is appearing in Google Analytics.
Alternatively, if you’re only using Universal Analytics, you can copy the shorter tracking code (UA-XXXXXXXX), then head into Squarespace Settings, followed by Advanced, and External API Keys, and paste it into the Google Analytics field instead. Again, you’ll only want to do this if you’re using Universal Analytics and not Google Analytics 4 — or both — or it could lead to some reporting issues.
If you’re using both, use the Global Site Tag.