How to Add an AI Chatbot via Google Tag Manager (GTM)
Deploy an autonomous AI customer support assistant across your entire website in under 5 minutes without editing theme files, requesting developer deployments, or touching source code.
Marketing teams, growth leads, and support managers frequently face deployment delays waiting for engineering sprints to add scripts into website templates. If your website already runs Google Tag Manager (GTM), you can install, configure, test, and publish your Knogents AI assistant directly from your GTM dashboard.
Because Knogents uses a lightweight, asynchronous JavaScript snippet (<12KB gzipped), managing it through GTM provides complete agility with zero performance penalties on your Google Core Web Vitals.
This is the exact code block you will paste into your GTM Custom HTML tag:
<!-- Knogents AI Chatbot via Google Tag Manager -->
<script
src="https://knogents.com/embed.js"
data-bot-id="YOUR_BOT_ID"
data-display-mode="floating"
data-position="right"
async
></script>Step-by-Step GTM Installation Guide
Retrieve Your Bot ID from Knogents
Log in to your Knogents dashboard, open your chatbot, and click the Deploy tab. Copy your unique embed script snippet containing your data-bot-id.
Create a New Custom HTML Tag in GTM
Open your Google Tag Manager container (tagmanager.google.com):
- Click Tags in the left sidebar navigation, then click the blue New button.
- Name your tag:
Knogents - AI Support Assistant. - Click Tag Configuration and select Custom HTML from the list of tag types.
- Paste your copied Knogents script code into the HTML text area.
Configure Advanced Settings (Prevent Duplicate Injections)
Click Advanced Settings inside the tag configuration box:
Select Once per page. This ensures that on Single Page Applications (Next.js, React, Vue, Shopify SPA transitions), subsequent router pageview events will not re-inject duplicate widget script elements.
Set Triggering to All Pages
Click the Triggering box below your tag configuration:
- Recommended: Select Initialization - All Pages. This fires the assistant early in the lifecycle without delaying page visual assets.
- Alternative (Consent Mode): If your site enforces strict cookie banner consent, select Consent Initialization - All Pages.
Click Save in the top-right corner to save your tag.
Test in Google Tag Assistant & Publish
Before publishing changes to production, verify functionality using GTM Preview:
- Click Preview in the top-right corner of your GTM workspace.
- Enter your website URL in the Google Tag Assistant window and click Connect.
- Confirm that
Knogents - AI Support Assistantappears under Tags Fired. - Check your site tab: the floating chat bubble will appear in the bottom-right corner! Test sending a query.
- Return to GTM, click Submit, add a version name (e.g. "Add Knogents Chatbot"), and click Publish.
Common GTM Deployment Troubleshooting
Your web server may enforce a Content Security Policy (CSP). Check browser console (F12) for Refused to load script from https://knogents.com. Update your CSP header to include script-src https://knogents.com.
Saving a tag in GTM does not make it live. Ensure you have clicked Submit and then Publish in the top-right of your workspace.
Frequently Asked Questions
Can I fire the chatbot only on specific URLs (e.g. /pricing or /support)?
Yes. Instead of using the "All Pages" trigger, create a Custom Trigger in GTM with Page Path conditions (e.g., Page Path contains /pricing). The assistant will only load and display on those targeted URLs.
Does GTM work with Shopify and WordPress websites?
Yes. If your Shopify store or WordPress site already has Google Tag Manager installed in its header/theme templates, deploying Knogents through GTM works immediately across all published pages.
Can I track chatbot engagement events back into Google Analytics 4 (GA4)?
Yes. Knogents dispatches standard DOM events upon widget open and message send, which can be captured via GTM Custom Event triggers to log conversions directly into your GA4 account.
Deploy Your Chatbot in GTM Today
Create your free Knogents assistant, copy your embed script, and publish through Google Tag Manager in minutes.