3 Ways To Install Google Analytics To Your Squarespace Site
Squarespace is a great option to create yourself a new website. And once you created your website you would want to add Google Analytics to it.
This article gives you the 3 options of how to do this.
I highly recommend adding Google Analytics to your site via Google Tag Manager, which is option 3 below.
Option 1 (the easy way): using the built-in option within Squarespace
Squarespace has an integrated way to install Google Analytics.
It is very straightforward to install this:
In the home menu, click Settings, and then click Advanced.
Click External Services.
In the Google Analytics Account Number box, enter your tracking ID for this site.
To locate your Google Analytics tracking ID, login to your Google Analytics account and go to Admin > Property > Tracking Info > Tracking Code. The Google Analytics tracking ID looks like UA-XXXXXXXX-X.
Option 2 (the advanced way): adding the entire snippet to Squarespace
Squarespace also has the option to add the entire Google Analytics snippet into the header of your webpage. The benefit of this option that you have more flexibility to make changes to your code snippet in the future.
To do this:
In the home menu navigate to Settings > Advanced > Code Injection.
Copy+paste the entire Google Analytics’ Global Site Tag into the Header field.
Option 3 (the recommended way): using Google Tag Manager
Google Tag Manager (GTM) is a free tool that makes it easier to add and update tracking tags within your website.
It’s recommended to use Google Tag Manager for all the tags on your site, including Google Analytics. It will make your life a lot easier going forward, and it potentially could also speed up your site. Also, it will allow you to track additional things on your site (like outgoing links, Youtube videos etc.).
Follow the steps in this article first to create a GTM account and install Google Analytics.
Then, to add the GTM code to your Squarespace site follow the steps below:
Login to Squarespace and from the home menu navigate to Settings > Advanced > Code Injection.
Replace GTM-XXXXXXXX for the code below with your GTM container ID. You can find this by logging into GTM. Copy and paste the code below into the ‘Header’ on the ‘Code Injection’ page.
<!-- Google Tag Manager -->
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s),
<!-- End Google Tag Manager -->
Then, replace GTM-XXXXXXXX for the code below with your GTM container ID. Then copy and paste the code below into the ‘Footer’ on the ‘Code Injection’ page.
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
And that’s it, you’re ready to start tracking your Squarespace website.