Plugin screenshot thumbnail 1/2
Plugin screenshot thumbnail 2/2

Code Snippets lets you manage and inject HTML/JavaScript snippets into your Craft CMS site directly from the control panel — no template editing required. Perfect for tracking codes, ad tags, chat widgets, and any third-party scripts.

A native Craft alternative to plugins like WPCode, Header & Footer Scripts, or Insert Headers and Footers for WordPress.

Features

  • Native element index — search, sort, filter, and bulk-manage snippets like Entries and Assets
  • Four insertion positions<head> start, </head> end, <body> start, </body> end (GTM-ready)
  • Auto-injection — snippets appear on the frontend automatically; no Twig changes needed
  • Optional Twig functionscraft.codeSnippets.headBegin(), headEnd(), bodyBegin(), bodyEnd() for explicit control
  • Environment filtering — restrict snippets to dev, staging, or production
  • URI pattern matching — target specific pages with wildcard support (e.g. products/*)
  • Sort order — control the order of multiple snippets in the same position
  • Bulk actions — enable/disable, duplicate, delete multiple snippets at once
  • Sidebar filtering — view snippets by insertion position
  • Permissions — separate view and manage permissions
  • English & Japanese translations included

Common Use Cases

  • Google Tag Manager (GTM) head and body snippets
  • Google Analytics (GA4), Meta Pixel, TikTok Pixel, LinkedIn Insight Tag
  • Hotjar, Microsoft Clarity, FullStory tracking
  • Intercom, Crisp, Tawk.to chat widgets
  • Custom verification meta tags (Google Search Console, Bing Webmaster)
  • Schema.org JSON-LD structured data
  • Cookie consent banners
  • Conversion tracking pixels for ad platforms

Why Code Snippets?

  • No template editing — content editors and marketers can manage scripts without developer help
  • Environment-aware — never accidentally fire production analytics in dev again
  • Page-specific — inject conversion pixels only on /checkout or /thank-you pages
  • Built on Craft elements — get all the UI features you already know

Standard

Plus $9/year after one year.

Installation Instructions

To install this plugin, copy the command above to your terminal.

Reviews

This plugin doesn't have any reviews.

Active Installs
0
Version
1.0.0
License
Craft
Compatibility
Craft 5
Last release
April 24, 2026