Jetrack

Jetrack

Installation Guides

Lovable Installation

Install Jetrack on your Lovable-built website

Lovable (formerly GPT Engineer) is an AI-powered web builder. Use these prompts to let the AI add Jetrack for you!

Copy and paste this prompt into Lovable's chat to add analytics:

Add Jetrack to my website. Add this script tag to the <head> section of all pages:

<script
  async
  defer
  data-website-id="your-unique-id"
  src="https://analytics.brandjet.ai/script.js">
</script>

Make sure it loads on every page of the site.

Replace your-unique-id with your actual BrandJet website ID from your dashboard.

Alternative Prompts

For React/Next.js projects:

Add Jetrack to my Next.js app. In the root layout file (app/layout.tsx), add this script using the Next.js Script component:

<Script
  src="https://analytics.brandjet.ai/script.js"
  data-website-id="your-unique-id"
  strategy="afterInteractive"
/>

Make sure to import Script from 'next/script'.

For environment variable support:

Add Jetrack with environment variable support:
1. Create a .env.local file with: NEXT_PUBLIC_BRANDJET_WEBSITE_ID=your-unique-id
2. Add the analytics script to the layout using the env variable
3. Make sure it only loads the script if the env variable is set

Manual Installation (If AI Doesn't Work)

For Static HTML

If Lovable generates static HTML, manually add to index.html:

<head>
  <!-- existing head content -->
  
  <script
    async
    defer
    data-website-id="your-unique-id"
    src="https://analytics.brandjet.ai/script.js">
  </script>
</head>

For React/Next.js

See the Next.js installation guide or React installation guide for detailed manual instructions.

Testing

After the AI adds the script:

  1. Ask Lovable to preview or deploy your site
  2. Open the live site
  3. Press F12 → Go to Network tab
  4. Refresh and look for script.js from analytics.brandjet.ai
  5. Check your BrandJet dashboard for visitor data

Pro Tips

Verify the installation:

Check if the Jetrack script was added correctly. Show me where it's located in the code.

If something's wrong:

The analytics script isn't loading. Please check if it's in the correct location and add it to the <head> section if it's missing.

For debugging:

Add console.log to confirm when the BrandJet script loads successfully.

Troubleshooting

Script Not Loading

Try this prompt:

The analytics script isn't loading. Please:
1. Verify the script is in the <head> section
2. Check that it's on all pages
3. Make sure the data-website-id attribute is correct

Changes Not Persisting

Save the Jetrack script permanently so it doesn't get removed when I make other changes.

Next Steps

On this page