Custom code
Add your own HTML, scripts and styles to the head or body of every page, and make them wait for cookie consent.
Custom code puts your own HTML on every page of your website, whatever theme you use. Use it for a site verification tag, a vendor's script, extra styles or a third-party chat widget. The code belongs to the website, not the theme, so it stays in place when you change themes.
You manage it on the Marketing page, in the Custom code tab.
Important: Who can use it
Custom code runs for every visitor, so it needs the theme code permission, the same permission that lets someone edit a theme's files. The owner always has it. The tab is hidden from anyone whose role does not include it. See Team and roles.
Where your code goes
There are four places, each with its own box:
| Place | Added | Good for |
|---|---|---|
| Start of the head | Right after <head> |
Code that must run before anything else, such as a verification tag |
| End of the head | Right before </head> |
Styles, meta tags and most tracking snippets |
| Start of the body | Right after <body> |
A <noscript> fallback a vendor asks for |
| End of the body | Right before </body> |
Chat widgets and scripts that can wait for the page |
Each box holds up to 65,535 bytes. The counter under the box shows how much you have used.
Add custom code
-
Open the Custom code tab
In the panel at https://accounts.in1s.com, open your website, then go to Marketing > Custom code.
-
Paste your code
Paste the code into the box for the place it belongs. It is saved exactly as you type it.
-
Choose a cookie category
Under Cookie category, choose what the code does. See below.
-
Save
Click Save. The code is live on every page straight away.
Cookie categories
Each box has a Cookie category. It matters only while the cookie consent banner is on:
- Strictly necessary (always runs): the code runs at once, before the visitor answers the banner.
- Analytics (runs after consent), Marketing (runs after consent) and Preferences (runs after consent): the code waits until the visitor allows that category.
New code is in the Marketing category unless you choose another. Pick the category that matches what the code does. A script that tracks visitors should never be Strictly necessary.
With the banner off, all custom code runs as soon as the page loads, whatever its category.
Where it runs and where it does not
- Custom code is added to every full page of your website.
- It shows when you preview your website, so you can check it.
- It is never added inside the theme editor's preview, so broken code cannot get in the way while you edit.
Things to know
Warning
Code here runs exactly as you write it, for every visitor. Paste only code you trust. Broken code can break your pages, just as a broken theme edit can.
- Code that waits for consent is started after the page has loaded, so a script that uses
document.writedoes not work in an optional category. - If a visitor withdraws consent, in1s cannot remove cookies that your custom code has set.
- To add Google Analytics, Tag Manager or the Meta Pixel, use the Tracking codes tab instead. in1s adds the correct tag and handles consent for you.
- Changes to custom code are recorded with the website's other settings, so you can see who changed it on the Activity page.