If you're using the Squarespace Version 7.0
, it has the Developers mode available which will allow you to install the Service worker file through FTP. For Squarespace Version 7.1 users, please skip this part and scroll down under "ALTERNATIVE INSTALLATION METHOD".
Now let's work on the Developers mode
Navigate under Settings> Advance> Developers Mode.
Enable the Developer Mode toggle and note down your CONNECTIVITY DETAILS:
Copy this information and paste it to the FTP tool of your choice, for this example, Filezilla is used (to go to this page, in Filezilla simply click Edit>Site Manager.
Once you're connected to the Squarespace’s FTP server, proceed with creating an ‘/sw’ folder/directory (short for ‘service worker’) and upload the firebase-messaging-sw.js file to it.
NOTE: with regular FTP installation the file is uploaded to the root of the server, however with Squarespace files uploaded to the root of the website are not accessible and they have to be installed in folders.
This Service Worker file will allow the automatic Native-browser opt-in as shown in the following screenshot once Subscribers is installed.
ALTERNATIVE INSTALLATION METHOD (HTTP)
If you're using Squarespace version 7.1, unfortunately, they have removed the Developers mode on this version so Service worker file installation is no longer possible.
No worries though because you can still install and use Subscribers by doing the basic copy and paste of script method, but the key is you'll need to change from HTTPS to HTTP within your Subscribers dashboard which is a bit weird but that basically enables that method for the installation.
This is an easy change though. Just make sure you're logged into Subscribers and change your "SITE URL" to HTTP
This little dropdown is what you need to toggle to HTTP: (NOT HTTPS)
Now navigate to your dashboard under "CODE INSTALL" and you'll find your complete installation script there under "Manual Installation".
And then navigate to your Squarespace> Settings> Advance> Code Injection> then insert your script in the Footer.
Please note that with this installation method which required switching from https to http within the Subscribers dashboard, the browser-native pop-up will not be available so you'll only have the Custom Prompt (Chicklet) similar to this one below.
You can go to your Dashboard's Prompt settings page to enable and further customize your opt-in prompt.