Where Do I Put Google Analytics Code in Squarespace?

You want to add Google Analytics tracking to your Squarespace site but are not sure where the code goes. Squarespace has a built-in Google Analytics integration field under Settings > External API Keys that accepts your GA4 Measurement ID directly, with no manual code editing required.
This guide covers exactly where to put your Google Analytics code in Squarespace, step by step. You will learn how to find your GA4 Measurement ID, add it to the right field, verify the connection, and filter out your own visits. For more on tracking your site's performance, see our SEO and analytics guide.
Where Do I Put Google Analytics Code in Squarespace?

Google Analytics is one of the best free tools for understanding how visitors interact with your Squarespace website. It shows you where your traffic comes from, which pages perform best, how long people stay, and where they drop off.

Setting it up on Squarespace takes just a few minutes. Below is a full walkthrough of where to enter your tracking code and how to confirm everything is working correctly.

What Is the Google Analytics Tracking Code?

The Google Analytics tracking code is a unique identifier tied to your Google Analytics account and website. For GA4 (Google Analytics 4), the code starts with "G-" followed by a string of letters and numbers. This Measurement ID tells Google which Analytics property should receive data from your site.

Each Squarespace site can only have one Google Analytics ID installed at a time. Squarespace has the necessary tracking scripts built into its platform, so you do not need to paste any JavaScript code manually. You just enter the Measurement ID in the right settings field.

Put Google Analytics Code in Squarespace - stylized elements such as bar graphs, pie charts, lines, and shapes

How Long Does It Take for Google Analytics to Start Working?

Once you add your Measurement ID to Squarespace, data usually appears in your Google Analytics dashboard within 24 hours. The Realtime report will show activity almost immediately if someone is browsing your site at that moment.

Google Analytics cannot pull in historical data from before installation. It only tracks visits that happen after the code is active. Also keep in mind that your own browsing activity will be recorded unless you set up a filter (covered below).

How to Add Google Analytics to Squarespace (Step by Step)

Follow these steps to connect Google Analytics to your Squarespace website:

  1. Log in to your Squarespace dashboard
  2. Click Settings in the left-hand menu
  3. Click Advanced
  4. Click External API Keys
  5. Find the field labeled Google Analytics
  6. Paste your GA4 Measurement ID (starts with "G-") into this field
  7. Click Save

That is all you need to do on the Squarespace side. Data will begin populating in your Google Analytics account within 24 hours.

Creating a Google Analytics Account (If You Do Not Have One)

If you have not set up Google Analytics yet, go to analytics.google.com and sign in with your Google account. Click Start Measuring and follow the prompts to create an account and property. Google will generate your GA4 Measurement ID at the end of the setup process. Copy this ID for use in Squarespace.

Make sure you select "Web" as your platform type when creating the data stream. The Measurement ID will be displayed on the data stream details page.

Verifying That Google Analytics Is Working

After adding the Measurement ID to Squarespace, open your Google Analytics account and go to Reports > Realtime. Open your Squarespace site in another browser tab and browse a few pages. If the Realtime report shows active users, the integration is working correctly.

If you see zero users after several minutes, double-check that you entered the correct Measurement ID and that you clicked Save in Squarespace. Also make sure there are no ad blockers or browser extensions interfering with the tracking script.

Tips for Getting Accurate Data

Verify Your Measurement ID Format

GA4 Measurement IDs start with "G-" (for example, G-ABC123DEF4). The older Universal Analytics format started with "UA-" but Google has fully transitioned to GA4. If you still have an old UA code, you will need to create a new GA4 property in your Google Analytics account.

Exclude Your Own Visits

Your own browsing can skew your analytics data, especially on smaller sites. To filter out internal traffic in GA4, go to Admin > Data Streams > your stream > Configure Tag Settings > Define Internal Traffic. Add your IP address so your visits are not counted in reports.

Check Data Accuracy Regularly

After setup, periodically check that your tracking is still working. Compare the Realtime report with actual site activity. Look at traffic sources and page views to make sure they match your expectations. Catching discrepancies early prevents months of unreliable data.

Frequently Asked Questions

Where exactly do I put the Google Analytics code in Squarespace?

Go to Settings > Advanced > External API Keys in your Squarespace dashboard. Paste your GA4 Measurement ID (starting with "G-") into the Google Analytics field and click Save. No manual code editing is needed.

Do I need to add any JavaScript code to Squarespace for Google Analytics?

No. Squarespace has the Google Analytics tracking script built into its platform. You only need to enter your Measurement ID in the External API Keys settings. Squarespace handles the rest automatically.

Can I use Google Analytics 4 (GA4) with Squarespace?

Yes. Squarespace supports GA4 Measurement IDs. Enter your GA4 ID (starting with "G-") in Settings > Advanced > External API Keys. Universal Analytics (UA) has been retired by Google, so GA4 is now the only option.

How long does it take for Google Analytics to show data from Squarespace?

Most data appears within 24 hours of adding your Measurement ID. The Realtime report in Google Analytics will show active visitors almost immediately, so you can use it to verify the connection right away.

Why is Google Analytics not tracking my Squarespace site?

Common causes include entering the wrong Measurement ID, forgetting to click Save, browser ad blockers preventing the tracking script from loading, or having a caching issue. Double-check your ID, clear your browser cache, and test in an incognito window.

Can I use Google Analytics and Squarespace Analytics at the same time?

Yes. Squarespace's built-in analytics and Google Analytics run independently. You can use both to get different perspectives on your traffic. Squarespace Analytics focuses on commerce and content metrics, while Google Analytics provides deeper traffic source and behavior data.

How do I exclude my own traffic from Google Analytics on Squarespace?

In GA4, go to Admin > Data Streams > select your stream > Configure Tag Settings > Define Internal Traffic. Add your IP address and set up a data filter to exclude it. This prevents your own visits from appearing in your reports.
Keep Reading

* Read the rest of the post and open up an offer
Top