Finding Your Script
Log into your Knock2 dashboard
Click Settings > Script
Click the Copy button to copy the script to your clipboard
Installing the Script
Paste the script in your website's </head>. The script should be on every page where you want to track visitors.
After installation, the status indicator will show "Active" in green.
Important Notes
We do not recommend installing via Google Tag Manager. We recommend the script be added directly to the
<head>of your site.The script loads asynchronously and won't slow down your page.
Once installed, visitors will start appearing in your dashboard within minutes.
Platform Guides
Webflow
Framer
WordPress
Squarespace
Shopify
Wix
HubSpot CMS
Next.js / React
Ghost
Carrd
Unbounce
Instapage
Leadpages
Kajabi
Go High Level (GHL)
ClickFunnels
Gatsby / Static HTML
Webflow
Webflow lets you add custom code at the site level (requires a paid site plan).
Log into Webflow and open the project where you want to install the script
Click the Webflow logo (top-left) and select Site Settings
In the left sidebar, click Custom Code
Paste the Knock2 script into the Head Code section
Click Save Changes, then click Publish to push the changes live
The script will automatically load on every page of your Webflow site.
Framer
Open your Framer project
Click the gear icon (Site Settings) in the top-right
Scroll to Custom Code and expand the Head section
Paste the Knock2 script
Click Save, then Publish
Framer applies head code globally, so the script will run on all pages.
WordPress
Choose the method that matches your setup.
Option A: Header Injection Plugin (Recommended)
This is the easiest method and doesn't require editing theme files.
Install and activate a header injection plugin such as WPCode or Head, Footer and Post Injections
In your WordPress dashboard, go to the plugin's settings (e.g., Code Snippets > Header & Footer for WPCode, or Settings > Header and Footer for Head, Footer and Post Injections)
Find the Header or HEAD section and paste the Knock2 script
Click Save Changes
Option B: Theme File Editor
If you're using Elementor, skip this method and use Option C below.
In your WordPress dashboard, go to Appearance > Theme File Editor
In the file list on the right, click header.php
Scroll to just before the closing
</head>tag and paste the Knock2 script. Do not overwrite any existing code.Click Update File
If your theme includes a Header Code Injection field in its settings, you can paste the script there instead of editing header.php directly.
Option C: Elementor
Elementor manages its own header templates, so the Theme File Editor method won't work.
In your WordPress dashboard, navigate to Elementor > Theme Builder and open your Header template
Click Edit with Elementor
Drag an HTML widget into the header section
Click the widget and paste the Knock2 script into the HTML code editor (make sure both the opening
<script>and closing</script>tags are included)Click Save, then clear any active caching plugins
Troubleshooting (WordPress)
Confirm the script appears only once in your source code. Duplication can cause errors.
If you see a blank screen after saving, re-check the script for missing or extra characters.
If you're using WP Rocket or another caching/optimization plugin, make sure the Knock2 script is excluded from any "Delay JavaScript" or "Defer JavaScript" settings.
Squarespace
Squarespace offers several options for adding custom scripts. We recommend using Code Injection.
Log into your Squarespace account
From the Home Menu, go to Website > Pages
Scroll down to Website Tools and click Code Injection (under Advanced)
Paste the Knock2 script into the Header field. This ensures the script loads on every page of your site.
Click Save
Code Injection is the recommended method. It applies the script site-wide without needing to edit individual page HTML.
Shopify
From your Shopify admin, go to Online Store > Themes
Click the three-dot menu (⋯) on your current theme and select Edit Code
Under Layout, click theme.liquid
Find the
</head>tag and paste the Knock2 script just above itClick Save
This installs the script on every page of your store, including product pages and checkout (if your plan allows theme editing on checkout).
Wix
Wix requires a Premium plan to add custom code.
In your Wix dashboard, go to Settings
Under the Advanced section, click Custom Code
Click + Add Custom Code in the top-right corner
Paste the Knock2 script into the text box
Give the snippet a name (e.g., "Knock2 Tracking Script") for easy reference
Under Add Code to Pages, select All pages
When prompted, set it to Load code on each new page (not once per session)
Under Place Code in, select Head
Click Apply
Setting the script to load on each new page (rather than once per session) is important. Loading it only once will limit Knock2's ability to track visitors across pages.
HubSpot CMS
In your HubSpot account, click the Settings icon in the top navigation bar
In the left sidebar, go to Content > Pages
Click the Choose a domain to edit dropdown and select your domain (or select Default settings for all domains to apply it everywhere)
In the Site Header HTML section, paste the Knock2 script
Click Save
This applies the script to every page on the selected domain.
Next.js / React
For React-based frameworks, add the script to your root layout or document.
Next.js (App Router)
In your app/layout.tsx (or .js):
export default function RootLayout({ children }) { return ( <html lang="en"> <head> {/* Paste Knock2 script here */} </head> <body>{children}</body> </html> ); }Next.js (Pages Router)
Create or edit pages/_document.tsx:
import { Html, Head, Main, NextScript } from 'next/document'; export default function Document() { return ( <Html> <Head> {/* Paste Knock2 script here using dangerouslySetInnerHTML */} <script dangerouslySetInnerHTML={{ __html: `// Paste the contents of your Knock2 script here`, }} /> </Head> <body> <Main /> <NextScript /> </body> </Html> ); }Create React App / Vite
Paste the Knock2 script directly into the <head> section of your public/index.html file.
Ghost
In your Ghost admin, go to Settings > Code Injection
Paste the Knock2 script into the Site Header field
Click Save
Ghost applies header code injection to every page on your site.
Carrd
Open your Carrd site in the editor
Click the gear icon (Site Settings) in the top-left
Go to the Head section under Settings
Paste the Knock2 script
Save and Publish
Carrd requires a Pro plan to add custom code.
Unbounce
Open your landing page in the Unbounce builder
Click JavaScripts in the bottom-left panel
Click Add New JavaScript
Set placement to Head
Paste the Knock2 script
Click Save and Republish
Unbounce adds scripts per landing page, so you'll need to add it to each page you want to track. Use Global Scripts if available on your plan to apply it across all pages.
Instapage
Open your page in the Instapage editor
Click Settings (gear icon)
Go to HTML/CSS > Head
Paste the Knock2 script
Click Save and Publish
Like Unbounce, Instapage is page-level. Add the script to each landing page you want to track.
Leadpages
Open your page in the Leadpages editor
Click Page Settings (gear icon in the left sidebar)
Go to SEO & Analytics > Head Section Tracking Code
Paste the Knock2 script
Click Save and Publish
Kajabi
Go to Settings > Site Details
Scroll down to Header Tracking Code
Paste the Knock2 script
Click Save
This applies the script to your entire Kajabi site, including course pages and landing pages.
Go High Level (GHL)
Go to Sites > Settings > Global Settings
Find the Tracking Code (Head) section
Paste the Knock2 script
Click Save
For a specific funnel page:
Open the funnel in the editor
Click Settings on the page
Paste the script in the Header Code field
Click Save
ClickFunnels
ClickFunnels 2.0
Go to Site Settings > Tracking Codes
Paste the Knock2 script in the Head Tracking Code field
Click Save
ClickFunnels Classic
Open your funnel and click Settings on the page
Go to the Tracking Code tab
Paste the script in the Header Code section
Click Save
ClickFunnels Classic requires adding the script to each funnel page individually.
Gatsby / Static HTML
For static sites built with Gatsby, Hugo, Jekyll, or plain HTML, add the Knock2 script directly to the <head> of your HTML.
Gatsby
Edit gatsby-ssr.js (create it if it doesn't exist):
export const onRenderBody = ({ setHeadComponents }) => { setHeadComponents([ <script key="knock2" dangerouslySetInnerHTML={{ __html: `// Paste the contents of your Knock2 script here`, }} />, ]); };Plain HTML
Open every HTML file and paste the Knock2 script inside the <head> tag:
<html> <head> <!-- Your existing tags --> <!-- Paste Knock2 script here --> </head> <body> ... </body> </html>
Troubleshooting
Script status still shows "Inactive"?
Make sure you published or saved your changes. Many platforms require a separate publish step.
Open your site in a browser, right-click, and select View Page Source. Search for "knock2" to confirm the script is in the
<head>.Clear your site's cache if you're using a CDN or caching plugin (common with WordPress).
Script installed but no visitors appearing?
Give it a few minutes. Visitors begin appearing in your dashboard shortly after the first page loads with the script active.
Confirm the script is loading by opening your browser's Developer Tools > Network tab and filtering for "knock2."
Using a custom domain with a proxy or CDN?
The script works behind Cloudflare, Vercel, Netlify, and other proxies. No special configuration is needed.
Need help? Contact us at support@knock2.ai or via the chat widget in your dashboard.