Skip to main content
A custom script is JavaScript that runs first on every page of your community site’s custom domain, before the rest of the page loads. Use it for tools that need to load early, such as a cookie consent banner or a chat widget. Add it in Studio under Site > Custom script.
Custom scripts only run on a custom domain, such as community.your-domain.com. They never run on a .tightknit.community subdomain. If your site doesn’t have a custom domain, your script will not run.

Requirements

  • Your community site uses a custom domain. Tightknit sets up custom domains for you: contact support to add one.
  • Your plan includes custom scripts.

Add a script

1

Paste your code

In Studio, go to Site > Custom script and paste your JavaScript into Head Script. Paste only the code, without <script> tags.If your vendor gives you a <script src="…"> tag, load the file from JavaScript instead. Copy the tag’s src URL, and add one setAttribute line for each other attribute on the tag:
2

Publish

Select Publish script and confirm. The script goes live on every page of your custom domain, for every visitor and member, within a few minutes.
3

Check it on your custom domain

Open your site on its custom domain and confirm the script runs, for example that your cookie banner appears.
Studio refuses a script that has <script> tags, that doesn’t parse as JavaScript, or that is longer than 65,536 characters, and says why under the field. A script can read and change anything on the page, for every visitor and signed-in member. Only add code from a source you trust.

Change or remove a script

Edit the code in Head Script and select Publish script to replace it. To remove it, select Remove script. Either change reaches your site within a few minutes.

Troubleshooting

The script doesn’t run. Check that you’re visiting your site on its custom domain. If your site has no custom domain, custom scripts don’t run anywhere: contact support to set one up. The script runs for some visitors but not others. Changes can take a few minutes to reach every visitor. If it still doesn’t run, check your browser’s developer console for errors from the script itself.