Adding Google Analytics to your Squarespace site lets you see who visits, what they look at, and how they found you. This guide walks you through connecting your Google Analytics property to Squarespace, whether you use the built-in integration or add the tracking code manually. You’ll need a Google Analytics account (the free version is fine) and access to your Squarespace site’s settings.
What You’ll Need
- A Google Analytics account (create one at analytics.google.com if you don’t have it)
- A Google Analytics property (usually created automatically when you sign up)
- A Measurement ID (starts with G-) for Google Analytics 4, or a Tracking ID (starts with UA-) if you’re still on Universal Analytics
- Admin access to your Squarespace site
Step-by-Step
- Get your Google Analytics Measurement ID. Log in to Google Analytics, click Admin (gear icon) at the bottom left. In the Property column, click Data Streams. If you have a stream, click it and copy the Measurement ID (looks like G-XXXXXXXXXX). If you don’t have a stream, click Add stream, choose Web, enter your website URL and stream name, then click Create stream and copy the Measurement ID.
- Open Squarespace and go to your site’s settings. Log in to Squarespace, open the site you want to track, and in the left menu click Settings (or the gear icon).
- Find the Google Analytics option. In the Settings panel, look for Developer Tools or Advanced (depending on your Squarespace version). In newer templates it’s under Developer Tools; in older ones it’s under Advanced → External API Keys or Code Injection. If you see a field labeled Google Analytics or Measurement ID, that’s the built-in integration.
- Paste your Measurement ID. In the Google Analytics field, paste the G- ID you copied. If you’re using Universal Analytics (UA-), paste that ID instead. Click Save.
- If you don’t see a dedicated field, use Code Injection. Go to Settings → Developer Tools → Code Injection. In the Header box, paste the full Google Analytics tracking snippet. For GA4, the snippet looks like this:
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script><script>window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-XXXXXXXXXX');</script>(replace G-XXXXXXXXXX with your ID). For Universal Analytics, paste the snippet that starts withgtag('config', 'UA-XXXXX-Y'). Click Save. - Verify the connection. Go to your live Squarespace site, load a page, and then in Google Analytics click Realtime in the left menu. You should see your own visit appear within a few seconds. If it doesn’t, wait a few minutes and refresh.
- If you use a cookie consent banner, make sure it doesn’t block tracking. Squarespace’s built-in cookie banner may prevent Google Analytics from loading until the visitor accepts cookies. If you want to track even before consent, you’ll need to adjust the banner settings or use a consent management tool that allows for “legitimate interest” tracking.
Common Mistakes
- Using the wrong ID. Make sure you copy the Measurement ID (G-) for GA4, not the property ID (which is a number) or the data stream ID (which is also a number).
- Pasting the snippet in the wrong place. The tracking code must go in the Header injection box, not the footer. Google Analytics requires it in the <head> section to work reliably.
- Adding the code twice. If you use both the built-in field and Code Injection, you’ll send duplicate hits. Choose one method.
- Forgetting to save. It sounds trivial, but many people paste the code and leave the page without clicking Save.
- Testing on a preview page. The tracking code only loads on your live site, not in the Squarespace editor preview. Always test on the public URL.
Tips
- Use Google Tag Manager if you plan to add more tags. Instead of pasting multiple snippets, add the Tag Manager container to your site and then add Google Analytics through Tag Manager. This keeps everything in one place.
- Set up a custom 404 page. In Google Analytics, you can create a report for page views to your 404 page to see broken links. Squarespace has a built-in 404 page, and you can use the tracking code to capture those hits.
- Enable enhanced measurement. In GA4, your data stream has an “Enhanced measurement” toggle that automatically tracks scrolls, outbound clicks, and site search. Turn it on to get more data without extra code.
- Exclude your own visits. Create a filter in Google Analytics to exclude traffic from your own IP address, so your numbers aren’t inflated.
Troubleshooting
No data in Realtime. If you don’t see yourself in Realtime after a few minutes, check that you’re on the live site (not the editor). Clear your browser cache and try again. Also confirm that the Measurement ID is correct and that you saved the settings.
Data appears but stops after a day. This is often due to a cookie consent banner blocking the script. In Squarespace, go to Settings → Cookies & Visitor Data and check if the banner is enabled. If it is, the tracking code will only fire after a visitor clicks “Accept.” You can change the banner behavior or use a consent management platform that allows for “legitimate interest.”
You see double counts. Double counting happens when you have both the built-in field and Code Injection active. Remove one of them.
The code injection box is missing. In some Squarespace plans (like Personal), Code Injection is not available. In that case, use the built-in Google Analytics field under Settings → Developer Tools → Google Analytics. If you don’t see that either, you may need to upgrade your plan.
Google Analytics shows “No data” after 24 hours. GA4 can take up to 24-48 hours to show standard reports. Realtime is instant, but standard reports have a delay. Wait a day and check again.
Frequently Asked Questions
Do I need a paid Google Analytics plan? No, the free version is fully functional for most sites. You only need Google Analytics 360 if you have very high traffic volume or need advanced features.
Can I use both Google Analytics and Squarespace’s built-in analytics? Yes, they can run side by side. Squarespace’s own analytics show you basic metrics, while Google Analytics gives you deeper insights like user demographics and behavior flow.
Will Google Analytics slow down my site? The script is lightweight and loads asynchronously, so it won’t noticeably affect page speed. However, if you have many tracking scripts, consider using Google Tag Manager to load them more efficiently.
Does Google Analytics track visitors across devices? Yes, if a visitor is logged into a Google account and has enabled ad personalization, GA4 can link sessions across devices. Otherwise, it treats each device as a separate user.
Can I track e-commerce purchases with Google Analytics on Squarespace? Yes, you can enable e-commerce tracking in GA4 and add the necessary code to your Squarespace site. Squarespace also has a native Google Analytics integration for e-commerce that you can turn on in the Commerce settings.
What is the difference between GA4 and Universal Analytics? GA4 is the current version of Google Analytics, which uses event-based tracking. Universal Analytics is the older version that uses session-based tracking. Universal Analytics stopped processing data on July 1, 2023, so you should use GA4.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Microsoft Surface Duo: The Foldable Phone Story
- Samsung SM-T813 Hard Reset: Step-by-Step Guide
- Mafia Clash Codes: Real Meanings & Usage
- Remove Programs from Mac: Full Uninstall Guide
- Project Sentinel Morning Digest: Data Stack Failure Alerts
- Best KVM VPS Hosting: Top Picks & Guide