Home Glossary Zoho Sites Code Snippet
Zoho Sites

Code Snippet

A Code Snippet in Zoho Sites is a special element that lets you embed raw HTML, CSS, or JavaScript directly into a page for custom widgets, third-party embeds, or advanced styling.

Feature

A Code Snippet in Zoho Sites is a page element that accepts raw HTML, CSS, and JavaScript, letting you embed third-party widgets, custom scripts, iframes, or advanced layout code that the standard element library does not cover natively.

How Code Snippet Works in Zoho Sites

You drag the Code Snippet element onto a page canvas just like any other element. A code editor opens where you paste or type your HTML, CSS, or JavaScript. The snippet is sandboxed within the section you drop it into, so it does not affect other page elements unless you intentionally write JavaScript that targets elements outside the snippet. The editor provides basic syntax highlighting, and a preview mode lets you see the rendered output before publishing.

When to Use Code Snippet

Use a Code Snippet when you need to embed content that Zoho Sites has no native element for: a Google Maps embed, a live chat widget, a custom pricing calculator, or a payment gateway button. It is also useful for adding schema markup such as JSON-LD to specific pages, or for including a third-party analytics tag on a single page rather than site-wide.

Key Considerations

Scripts added via Code Snippet execute in the visitor’s browser, so poorly written JavaScript can slow page load or conflict with Zoho Sites’ own scripts. Always test on a staging page before publishing to the live site. Some Zoho Sites plans restrict the use of external scripts for security reasons, so check plan limits if a snippet fails to execute.

India Example

A CA firm in Delhi added a Code Snippet to their contact page to embed a Calendly scheduling widget, allowing clients to book tax consultation appointments directly from the website. The snippet took five minutes to add and eliminated around 30 phone calls per week that had previously been used only to schedule meetings.

Can I add a Code Snippet to every page at once, like a global header script?

For truly global scripts, Zoho Sites provides a site-wide header and footer code injection section under site settings, separate from the Code Snippet element. Use that for scripts such as Google Analytics that need to run on every page.

Does Zoho Sites sanitise or restrict what I can put in a Code Snippet?

Zoho Sites allows standard HTML, CSS, and JavaScript in Code Snippets but may restrict certain script patterns on lower-tier plans. iframes and third-party embed codes from reputable services generally work without issue.

Need help implementing this in Zoho?

Aaxonix is a certified Zoho implementation partner based in Pune. Architecture-first, no surprises.