To add code to Squarespace, you can follow these steps.
A. CSS code
You can follow this guide.
B. script code
#1. Click Website Tools under Not Linked
#2. Click Code Injection
#3. You can paste your code to Header or Footer
#4. You can also add code to Individual Page Header Code Injection or Code Block or Markdown Block (however code won’t work properly on all cases with Markdown Block)