← Back to Trustlytics Sign in
Support Center Settings Tracking code Add the tracking code in Squarespace

Add the tracking code in Squarespace

In Squarespace, the custom code feature is called "Code Injection". You paste the Trustlytics code into the "Header" field one single time, click Save, and from that moment on every page of your website is measured. Including every page you create later on. About three minutes of work.

One thing you should know first. "Code Injection" is only available on the paid Squarespace plans.

Quick with the video or thorough with screenshots:

The video is in the works. Until then, the guide will get you there.

Step-by-step guide

What you need for this

  • A paid Squarespace plan. "Code Injection" is a premium feature. You get it on the Core and Advanced plans, and depending on how old your account is, it may also be called Professional, Business, Commerce, or Premium. On the Basic plan (formerly Personal), the menu item is missing entirely, and there is no way around that.
  • Your tracking code. You get it under Tracking code with one click on "Copy".
  • Access to your Squarespace account with administrator rights. As a contributor with limited rights, you will not see this area.

Selecting your website

Sign in to Squarespace and pick the website you want to measure. You land in the dashboard, meaning the management area of your website.

On the left, click "Website".

A submenu opens. Click "Pages" there.

Are you in the editor instead of the dashboard? You will only find this setting in the admin area of your website. Leave the editor and switch back to the dashboard.
Add the tracking code in Squarespace: Select your website - Trustlytics
Add the tracking code in Squarespace: Select Website - Trustlytics
Add the tracking code in Squarespace: Select Pages - Trustlytics

Pages settings

At the very bottom of the Pages settings, click "Custom Code" on the left.

A submenu opens. Click "Code Injection" there.

You land on the "Code Injection" page. You will recognize it by the two large text fields titled "Header" and "Footer".

Add the tracking code in Squarespace: Select Custom Code - Trustlytics
Add the tracking code in Squarespace: Select Code Injection - Trustlytics
Add the tracking code in Squarespace: Code Injection page - Trustlytics

Pasting in the tracking code

Click into the upper "Header" field and paste your tracking code there. The field is allowed to contain other code already. Just add yours underneath without deleting anything.

Use the Copy button in your Trustlytics account. Selecting it by hand loses a character fast, and then Trustlytics counts nothing at all.
Add the tracking code in Squarespace: Paste the tracking code - Trustlytics

Saving

Click "Save" in the top left. Only then is the code stored.

Just closing the panel is not enough. Anyone who leaves the window without saving loses the entry, and the field will be empty again afterward. Take a quick look at whether the Save button is grayed out. Then everything is secure.

If your website is already publicly reachable, that was the last step. The code is active on all pages right away, no additional publishing is needed. If your website is still set to private or was never launched, switch it to public first. Before that, nobody can be counted because nobody can get there.

Add the tracking code in Squarespace: Save - Trustlytics

Checking

Now the moment of truth, and it takes less than two minutes:

  1. Open your website in a new browser window.
  2. Click through a few pages.
  3. Switch to the Real-time report in Trustlytics.
  4. Within a few seconds, your own visit should show up there.

If something is there, everything is installed correctly. If it stays empty, the section below will help.

Do not test in the editor preview. Custom code does not run there. Squarespace sometimes asks whether scripts should be enabled in the preview. Leave that alone, it gains you nothing and can mess up editing your website.

When nothing gets counted

Six causes cover almost every case:

Cause What to do
Not saved The most common case. Open "Code Injection" again. If the "Header" field is empty, the save did not go through. Paste the code and click "Save" in the top left.
Code in the Footer instead of the Header Cut it and put it into the upper "Header" field. Then save once more.
Only tested the preview Open your website at its proper address in the browser, not through the editor.
Website not public yet As long as your website is private or password protected, no real visits happen.
Cookie banner blocks scripts If you use the Squarespace cookie banner and tied custom scripts to consent, Trustlytics only loads for visitors who clicked. Trustlytics sets no cookies and does not need that link. Take it out.
Wrong address registered The code only works on the website listed in your Trustlytics account. Check that under Website.

If you still see nothing after that, reload your website with Ctrl + F5 (on a Mac, Cmd + Shift + R). Squarespace and your browser keep pages cached for a while, and then you are still looking at the old version without the code.

Common questions

Do I need a paid Squarespace plan?
Yes. "Code Injection" is only available starting with the Core and Advanced plans, sometimes also called Professional, Business, Commerce, or Premium. On the Basic plan (formerly Personal), the menu item is missing.

I cannot find "Code Injection" in the Pages settings. What is going on?
Usually it comes down to one thing: you have a Basic plan, and then the feature does not exist at all. To be sure, click the search icon (the magnifying glass) at the top of the dashboard and type "Code Injection". If the search finds something, click on it, and you land directly on the right page. If it finds nothing, an upgrade might be worth a look.

Do I have to paste the code into every page individually?
No. Whatever is in the "Header" field, Squarespace puts into the head section of every page of your website. New pages, blog posts, and product pages are included automatically.

Header or Footer, what is the difference?
The header loads before the page content, the footer only after. Every second counts for the measurement. Anyone who leaves a page quickly is simply not recorded when the code sits in the footer. That is why it goes in the header.

Do I have to republish my website afterward?
Not for a website that is already public. Saving is enough, the change is live immediately. Only if your website has not been launched yet do you need to take care of that first.

There is also a field for individual pages. Should I use that?
No. For Trustlytics that would be the wrong spot, because you would have to repeat it on every page and every time you create a new one.

Do my visitors need a cookie banner now?
No. Trustlytics works without cookies. Your visitors do not have to click anything away or confirm anything. If you already use the Squarespace cookie banner, please do not tie our code to consent. Otherwise, you will be missing all the visitors who did not click.

Can I remove the code later?
Yes. Open "Code Injection", delete the Trustlytics section from the "Header" field and click "Save". From then on, nothing is measured anymore.

Will my website get slower because of it?
No. The script is tiny and loads in the background without holding up the rest of your page.

Was this article helpful?