Background
⌘K

Bolt.new Integration

Learn how to integrate Affonso affiliate tracking into applications generated by Bolt.new.

Silvestro
Written by Silvestro
Updated more than a month ago

Bolt.new is an AI-powered web development tool that generates complete applications from text prompts. To add Affonso tracking to your existing project, use the optimized prompt below.

Prompt

Copy and paste this prompt into Bolt.new to add Affonso tracking to your existing project:

Add Affonso.io affiliate tracking to this project with the following requirements:

SCRIPT TO IMPLEMENT:
<script async defer
src="https://affonso.io/js/pixel.min.js"
data-affonso="YOUR_PUBLIC_PROGRAM_ID"
data-cookie_duration="YOUR_COOKIE_DURATION"
></script>

IMPLEMENTATION GUIDELINES:
1. Add the script to the HTML <head> section (not body)
2. Ensure it loads on ALL pages/routes of the application
3. For React/Next.js: Use next/script component with strategy="afterInteractive"
4. For vanilla HTML: Place directly in index.html head section

REQUIREMENTS:
- Script must load asynchronously (async defer attributes)
- Must be compatible with existing framework architecture
- Should not interfere with existing JavaScript
- Must work with client-side routing if present

TESTING INTEGRATION:
- Ensure window.affonso_referral is available globally

Please implement this tracking script following these guidelines.

Replace YOUR_PUBLIC_PROGRAM_ID with your actual Program ID.

Troubleshooting Prompts

If the initial implementation doesn't work, use these follow-up prompts:

Script not loading:

The affiliate tracking script is not loading. Please:
1. Check if the script tag is properly placed in the <head>
2. Ensure async and defer attributes are present
3. Verify the script URL is correct: https://affonso.io/js/pixel.min.js
4. Make sure there are no console errors blocking the script

Missing on some pages:

The tracking script only works on some pages. Please:
1. For SPAs: Ensure the script is in the root layout/app component
2. For Next.js: Place in _app.js or layout.js, not individual pages
3. Verify the script loads before any route changes occur

Testing Your Implementation

  1. Run your application using Bolt.new's preview
  2. Visit your app with ?atp=test
  3. Check browser DevTools → Console → type window.affonso_referral
  4. You should see a tracking ID if everything works correctly

Next Steps

Once installed, you can access affiliate referral data and pass it to your payment provider. Connect your payment provider →

Was this article helpful?

If you still need help, our support team is here for you.

Contact Support
bg

Ready to Scale Your SaaS?

Affonso is the easiest way to launch your own affiliate program. We take care of the technical stuff, so you can focus on growing your business.