CleverSearch
CleverSearch

Tracker Script Installation

Learn how to install and configure the CleverSearch tracker script on your website to enable AI-powered content optimization and analytics.

What This Script Does
💉

Automatic Content Injection

Dynamically injects optimized titles, meta descriptions, keywords, FAQs, and content paragraphs

🔄

SPA Navigation Support

Automatically detects and handles single-page application route changes (Next.js, React, Vue, Angular)

📊

Performance Tracking

Tracks Core Web Vitals (LCP, FID, CLS) and page performance metrics

📈

Analytics Collection

Collects user behavior data, page views, and interaction events

🛡️

Error Handling

Robust error handling with automatic retries and graceful degradation

🔍

Debug Mode

Built-in debugging capabilities for troubleshooting integration issues

Platform-Specific Installation

Next.jsReact framework with App Router
Use Next.js Script component for optimal performance
<Script
  src="https://backend.cleversearch.ai/tracker/v1/tracker.js"
  strategy="beforeInteractive"
  async
  data-config='{"SITE_ID": "your-site-id"}'
/>
ReactCreate React App, Vite, or other React setups
Place in public/index.html or equivalent
<script
  src="https://backend.cleversearch.ai/tracker/v1/tracker.js"
  async
  defer
  data-config='{"SITE_ID": "your-site-id"}'
></script>
WordPressTraditional WordPress sites
Add to header.php or use a plugin
<script
  src="https://backend.cleversearch.ai/tracker/v1/tracker.js"
  async
  defer
  data-config='{"SITE_ID": "your-site-id"}'
></script>
ShopifyShopify store themes
Add to theme.liquid in the <head> section
<script
  src="https://backend.cleversearch.ai/tracker/v1/tracker.js"
  async
  defer
  data-config='{"SITE_ID": "your-site-id"}'
></script>
WixWix website builder
Add via Custom Code element in Wix Editor
<script
  src="https://backend.cleversearch.ai/tracker/v1/tracker.js"
  async
  defer
  data-config='{"SITE_ID": "your-site-id"}'
></script>
SquarespaceSquarespace websites
Add via Code Injection in Site Settings
<script
  src="https://backend.cleversearch.ai/tracker/v1/tracker.js"
  async
  defer
  data-config='{"SITE_ID": "your-site-id"}'
></script>
OtherAny HTML website
Place in the <head> section of your HTML
<script
  src="https://backend.cleversearch.ai/tracker/v1/tracker.js"
  async
  defer
  data-config='{"SITE_ID": "your-site-id"}'
></script>
Configuration Options

Required Configuration

data-config='{"SITE_ID": "your-site-id"}'

Replace "your-site-id" with your actual site ID from the dashboard.

Optional Configuration

data-config='{
  "SITE_ID": "your-site-id",
  "API_BASE": "https://backend.cleversearch.ai",
  "DEBUG_MODE": false,
  "RETRY_ATTEMPTS": 3,
  "TIMEOUT": 2000
}'

Most users only need the SITE_ID. Other options are for advanced use cases.

Troubleshooting

Script not loading

Check that the script URL is accessible and your SITE_ID is correct

Content not injecting

Verify your site ID and check browser console for errors

SPA navigation not working

Ensure the script loads before your SPA framework initializes

Performance impact

The script is optimized for minimal impact, but check network tab for any issues

Debug Mode

Enable debug mode to see detailed logging in the browser console. This helps troubleshoot integration issues and verify the script is working correctly.

Enable Debug Mode

Method 1: URL Parameter

?clever-search-debug=true

Method 2: Configuration

data-config='{"SITE_ID": "your-site-id", "DEBUG_MODE": true}'

Global API

The script exposes a global API for manual control:

window.LLMOptimizer.refresh() // Refresh contentwindow.LLMOptimizer.getStats() // Get statisticswindow.LLMOptimizer.enableDebug() // Enable debug mode

Next Steps

After installing the tracker script, you can start optimizing your content and tracking performance.

Import Your SitemapContent Injection SetupTroubleshooting Guide

Tracker Reliability

Reliable data collection is the foundation for accurate optimization.

●Confirm tracker execution on every important route and locale.
●Watch for ad blockers, CSP rules, and script ordering conflicts.
●Validate data payload completeness during deployments.
●Review performance impact and keep script loading non-blocking.

Execution Phases

Week 1: Foundation

Finish installation and validate data flow.

Output: Connected tracker, imported sitemap, baseline analysis report.

Week 2: Prioritization

Select high-impact pages and define task backlog.

Output: Prioritized optimization list with owners and due dates.

Week 3-4: Iteration

Ship updates and verify score + business impact.

Output: Before/after snapshots with measurable deltas.

Common Mistakes

●Starting automation before validating tracker and sitemap integrity.
●Treating overall score as the only KPI and ignoring category gaps.
●Rolling out broad template changes without controlled testing.
●Skipping documentation of changes, making results hard to attribute.

Success Metrics

Analyzed Coverage

>= 90% priority URLs analyzed monthly

Ensures optimization decisions are based on current data.

Score Movement

+8 to +15 points on target templates in 30-60 days

Validates that executed recommendations are improving quality.

Execution Velocity

At least 1 improvement cycle per week

Creates compounding gains from consistent iteration.

Cleversearch

Increase your website's visibility in ChatGPT, Claude, and Gemini responses. Optimize your content for LLM citation and discovery.

mansi@cleversearch.ai
+1 (604) 705-0740
New Westminster, BC

Product

  • Product Overview
  • Content Features
  • Content Writer
  • Auto Agent
  • Pricing

Resources

  • Blog
  • AI Tools
  • AI Scoring Tools

Comparisons

  • Cleversearch vs Profound
  • Cleversearch vs Search Atlas

Company

  • Services
  • About Us
  • Careers
  • Contact

Stay ahead of LLM optimization trends

Get weekly insights on LLM citation strategies, content optimization, and platform updates.

© 2024 Cleversearch. All rights reserved.

Privacy PolicyTerms of ServiceCookie Policy