Installation Guide

Get started with TwoBucks Analytics in minutes.

Quick Start

Add this code to your website's <head> section:

<script
  src="https://www.twobucks.ai/script.js"
  data-website-id="your-website-id"
  async
></script>

Get Your Website ID

  1. Sign up at twobucks.ai
  2. Create a website
  3. Copy your tracking code from Settings

Verification

Check your browser console for:

✓ TwoBucks Analytics loaded
✓ Pageview tracked

Troubleshooting

Tracking Not Working

  • Check script is loaded: Open browser DevTools → Network tab → Look for script.js
  • Check console errors: Open browser DevTools → Console tab → Look for errors
  • Verify website ID: Ensure data-website-id matches your website ID from Settings
  • Check origin validation: Ensure your website domain matches the domain in Settings

Common Issues

Script not loading:
  • Check if your site blocks external scripts
  • Verify the script URL is correct
  • Check browser console for CORS errors
Events not tracking:
  • Verify website ID is correct
  • Check that your domain matches the domain in Settings
  • Ensure script is in <head> or before </body>

Framework-Specific Guides

Need help installing on a specific platform? Check out our framework-specific installation guides:

Content Security Policy (CSP)

If your website has a strict Content Security Policy, you may need to allow scripts from www.twobucks.ai.

HTML Meta Tag:

<meta http-equiv="Content-Security-Policy" 
      content="script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.twobucks.ai; ...">

Next.js Configuration:

const securityHeaders = [
  {
    key: 'Content-Security-Policy',
    value: [
      "default-src 'self'",
      "script-src 'self' 'unsafe-eval' 'unsafe-inline' https://www.twobucks.ai",
      // ... other directives
    ].join("; ")
  }
]