Hey there, Benjamin from Loves Data here.
Welcome back!
In this video, I'm going to show you how to install GA4 Google
Analytics 4 on your Squarespace site.
Adding Google Analytics to your Squarespace site doesn't take long,
and it unlocks additional reports and advanced features that complement
the built-in Squarespace Analytics.
There are different ways you can add Google Analytics to your Squarespace site.
I'm going to cover the options, and then you can choose the
one that fits your needs.
First, I'm going to cover Squarespace's built-in Google Analytics integration,
which lets you add GA4 to your site.
This is the quickest and easiest way to get up and running.
And I am also going to show you how to install Google Analytics
using Google Tag Manager.
This takes a little bit more time but gives you additional flexibility when
you want to customize your tracking and add any additional tags to your website.
Okay, let's head to Squarespace!
To use the built-in Google Analytics integration we navigate to 'Settings'...
Scroll down to the bottom...
Select 'Advanced'...
And then choose 'External API Keys' at the top...
At the top we can see the built-in Google Analytics integration
for our Squarespace site...
This lets us add our measurement ID from our GA4 Google Analytics 4 property.
It also lets us add our tracking ID from Universal Analytics, which is the
previous version of Google Analytics.
Or we can add both.
GA4 is the latest version of Google Analytics you can easily identify the
IDs for the latest version because they start with a 'G' and then a dash.
While the IDs for the previous version, so Universal Analytics,
begin with 'UA' and then a dash.
We can see for my Squarespace site, I already have Universal Analytics
installed using the built-in integration.
So we're going to leave this and add the GA4 measurement ID so that we're sending
data to both versions of Google Analytics.
If you're not currently using Universal Analytics, then you don't need to
add it, since this version will stop collecting data in mid-2023.
Okay, let's head to Google Analytics to find our GA4 measurement ID...
I've already logged into my GA4 property, but if you're getting started with
the new version of Google Analytics for the first time, then I've included
a link to my dedicated tutorial in the description below this video.
Now we need to navigate to 'Admin'...
You can easily identify which version of Google Analytics you're
using once you've selected 'Admin'.
If you see two columns, like we can see here, then you're
using Google Analytics 4.
And if you see three columns, then you're using the previous
version, so Universal Analytics.
Since we can see two columns, it means we're using the latest
version, so let's select 'Data Streams' in the second column...
Now you will need to select the data stream for your website.
In most cases, you will have one data stream just like me, but if you do have
multiple streams, then select the one you want to use for your Squarespace site...
Now we need to copy the measurement ID at the top...
And now let's head back to Squarespace...
Now we can paste the measurement ID into Squarespace...
If you want to send data to both versions of Google Analytics, then just make
sure there is a comma between the IDs...
And now let's click 'Save'...
We've installed Google Analytics on our Squarespace site!
This is the quickest way to get up and running.
The built-in integration will let you measure all of the pages on
your Squarespace site and if you're selling items, then it will also
automatically report purchases too.
Now we're going to look at the second way you can install Google
Analytics on your Squarespace site.
We're going to use Google Tag Manager.
It does take a little bit of extra time, but it provides more flexibility.
To add Google Tag Manager we will be using the 'Code Injection feature.
This means you will need to be on a 'Business' or 'Commerce'
plan for your Squarespace site.
Okay, let's head back to Squarespace...
Let's navigate to 'Settings'...
Then scroll to the bottom, and select 'Advanced'...
Now we choose 'Code Injection'...
This lets us add code to all of the pages of our Squarespace site
and this is how we're going to add Google Tag Manager to our website.
We need to get our Google Tag Manager container code, so let's
head to Google Tag Manager...
I've already created a Google Tag Manager container, so I'm going to
click on the container ID at the top...
We can now copy the container code...
If you're new to Google Tag Manager, then you can find links to my Google
Tag Manager tutorials and course in the description below this video...
Now that we've copied the code, let's head back to Squarespace...
We can now paste the Google Tag Manager container code
into the 'Header' section...
And click 'Save'...
Now that we've installed Google Tag Manager on Squarespace it's
time to configure our tags.
Let's head back to Google Tag Manager...
We need to add our tags to Google Tag Manager and we also need
to apply triggers to our tags.
Triggers are used to control when your tags should and
shouldn't fire on your website.
And let's create a new tag...
Let's name the tag 'Google Analytics GA4'...
And let's select 'Tag Configuration'...
And choose 'GA4 Configuration' as the tag type...
We need to find the measurement ID for our GA4 property, so
let's head to Google Analytics...
Let's navigate to 'Admin'...
And this is my GA4 property.
Okay, let's select 'Data Streams'...
I'm going to select my data stream...
And on the top right corner we can find our measurement ID...
Let's copy this...
And now let's head back to Google Tag Manager...
Let's paste our measurement ID into our tag...
And now let's select 'Triggering'...
And we're going to add the 'All Pages' trigger to our tag...
This will mean that our tag is added to all of the pages
on our Squarespace site...
Now we can save our tag...
We've now added GA4 to Google Tag Manager.
I'm also going to cover the steps to add Universal Analytics,
but if you're not using this version, feel free to skip ahead.
Let's create another tag...
Let's name the tag 'Google Analytics UA'...
And let's select 'Tag Configuration'...
Now we're going to choose 'Universal Analytics' as the tag type...
We select the drop-down under 'Google Analytics Settings'...
And choose the option to create a new variable...
Let's name the variable 'Universal Analytics'...
And now we need our Google Analytics tracking ID.
Let's head back to Google Analytics to find it...
Let's navigate to my Universal Analytics property...
And choose 'Property Settings'...
We need to copy the tracking ID at the top...
Now let's head back to Google Tag Manager...
Let's paste our tracking ID into the variable...
And save it...
Now we need to add a trigger to our tag, so let's select 'Triggering'...
Again, We're going to select the 'All Pages' trigger...
Now we can save the tag...
We've now added both versions of Google Analytics to our Google
Tag Manager container, so let's go ahead and click 'Preview'...
We can enter the URL of our Squarespace site...
And click 'Connect'...
Our website had loaded and we can now preview the tags that we added.
Let's select the 'Tag Assistant' tab...
We can see both of our Google Analytics tags have fired.
Now we need to head back to Google Tag Manager...
And to publish our tags to our website we need to click 'Submit'...
Name the version...
And click 'Publish'...
The tags have now been published on our Squarespace site.
Since we're now using Google Tag Manager to add Google Analytics to
our website, it's important to remove any IDs from the built-in integration.
So let's head back to Squarespace...
We need to navigate to 'Settings', then 'Advanced'...
And select 'External API Keys'...
We can see IDs are currently entered for the Google Analytics integration.
If we leave these, then we will be double-counting pages on our
site, so let's remove these...
And click 'Save'...
This means we're only using the code injection option to add the
Google Tag Manager code to our Squarespace site and Google Tag Manager
contains our Google Analytics tags.
If you're selling products using Squarespace, then there is one major
limitation with Google Tag Manager.
You will only be able to capture some basic transaction details, you won't
be able to report on the individual products people are purchasing.
This is actually a limitation of Squarespace, not Google Tag Manager,
so I want to show you a technique you can use to get around this.
We're going to use a combination of the in-built integration
and Google Tag Manager.
Let's head back to Squarespace...
Before I show you how to use a combination of the built-in integration and Google Tag
Manager, I also want to show you what you can track only using Google Tag Manager.
Let's navigate back to 'Code Injection'...
And if we scroll to the bottom, we can see there is an option to inject
code on the order confirmation page.
So if you only want to use Google Tag Manager, you can make use of
Squarespace's tags to send transaction details through to Google Analytics.
However, we can see there are only options for the order ID, the subtotal, grand
total, and the customer's email address...
Squarespace doesn't provide details for the items people have ordered.
So you could use code like this...
Which will let you send a transaction ID and order value to Google Analytics.
If you would like to learn more about this option and get the code I've used,
then you can find a link to my blog in the description below this video.
I'm going to remove this because I'm going to show you how to use
a combination of the built-in integration and Google Tag Manager.
What we're going to do is use the built-in Google Analytics integration,
which will automatically send page views and purchases to GA4, and then we will
use Google Tag Manager to capture any additional details we want in our reports.
Scrolling back to the top, we can see we already have the Google Tag Manager
container code added to the website...
So now let's navigate back to 'External API Keys'...
And we're going to paste our measurement ID from GA4 into
the in-built integration...
And we're going to click 'Save'...
This means we now have Google Analytics installed twice on our Squarespace site.
So we need to remove the page view from being tracked in Google Tag Manager.
Let's head to Google Tag Manager to do this...
This is the same container we were using previously, so let's navigate to 'Tags'...
Let's select our GA4 configuration tag...
And let's select 'Tag Configuration'...
Now let's deselect the option to send a page view event for the tag...
And let's save the tag...
This means we won't be sending duplicate page views to Google Analytics.
Now you might be wondering why you would want to do all of this.
Well, it's because you can use Google Tag Manager to easily track
other actions on your website.
We're basically using it to track anything that isn't a page view
or a purchase on Squarespace.
For example, let's say we want to track when someone clicks a button.
We can do this in Google Tag Manager.
Let's take a look...
Let's create a new tag...
Let's name the tag 'Google Analytics GA4 Button Click'...
Let's select 'GA4 Event' as the tag type...
And we need to select our GA4 configuration tag..
Now let's name the event 'click', 'underscore', 'button'...
I'm going to keep things simple, so I'm not going to send any other details
to Google Analytics, but you can send additional parameters with your event.
Now let's select 'Triggering'...
And let's click the plus sign to create a new trigger...
Let's name the trigger 'Button Click'...
And let's select 'Click All Elements' as the type...
Let's select 'Some Clicks'...
Now I'm going to enable the 'Click Classes' variable...
And I'm going to leave 'contains'...
And then I'm going to enter 'sqs', 'dash', 'button', 'dash', 'element',
'dash', 'dash', 'primary'...
This will mean our tag will fire when buttons are clicked
on our Squarespace site.
Okay, let's save the trigger...
And the tag...
Now let's click 'Preview'...
Load our website...
And let's navigate to the page with the button...
And let's click the button...
Now let's open Tag Assistant...
And let's select the GA4 measurement ID at the top...
We can see the page view and other automatic events have
been sent to Google Analytics.
This is from the built-in integration...
And we can also see our new 'click button' event has also been sent to
Google Analytics from Google Tag Manager.
When you're happy everything is working correctly, you can head back to Google
Tag Manager and publish the changes.
You should only use one of the options we've covered.
So you can use the built-in integration or use Google Tag Manager.
And if you're selling products on your Squarespace site, then you can use a
combination of both, but remember you need to ensure that you've disabled the
page view event in Google Tag Manager.
If you're not selling products, then you can use Google Tag Manager
for more flexibility and to add additional tags to your website.
Which option are you going to use to install Google Analytics
on your Squarespace site?
I'd love to know!
Let me know in the comments below.
And if you found this video helpful, then please like it, so I know to
make more videos like this one.
Thanks for watching, and I'll see you in the next video!