Website Tracking

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:

  1. In the home menu, click Settings, and then click Advanced.

  2. Click External Services.

  3. 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:

  1. In the home menu navigate to Settings > Advanced > Code Injection.

  2. Copy+paste the entire Google Analytics’ Global Site Tag into the Header field.


To locate your Global Site Tag, login to your Google Analytics account and go to Admin > Property > Tracking Info > Tracking Code.

Screenshot of code injection page on Squarespace.


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:

  1. Login to Squarespace and from the home menu navigate to Settings > Advanced > Code Injection. 

  2. 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 -->

<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-XXXXXXX');</script>

<!-- 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.


<noscript><iframe src="https://www.googletagmanager.com/ns.html?id='GTM-XXXXXXX'"

height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>


And that’s it, you’re ready to start tracking your Squarespace website.

Author


Avatar

Jeroen Minks

With over 10 years experience in digital marketing, Jeroen helps businesses to get more results out of their online advertising budgets.