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
- Run your application using Bolt.new's preview
- Visit your app with
?atp=test
- Check browser DevTools → Console → type
window.affonso_referral
- 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 →