Lovable generates full-stack web applications with modern frameworks. To add Affonso tracking to your existing Lovable project, use the optimized prompt below.
Prompt
Copy and paste this prompt into Lovable to add Affonso tracking to your existing project:
Add Affonso.io affiliate tracking system to this project with the following specification:
TRACKING SCRIPT:
<script async defer src="https://affonso.io/js/pixel.min.js" data-affonso="YOUR_PUBLIC_PROGRAM_ID" data-cookie_duration="30"></script>
IMPLEMENTATION REQUIREMENTS:
1. Place script in the HTML <head> section of the main template
2. Ensure compatibility with the existing framework (React/Vue/etc)
3. Script must load on all pages and persist across navigation
4. Use proper async/defer attributes for performance
5. For React apps: Consider using useEffect or Script component
6. For server-side rendering: Ensure script loads on client-side
INTEGRATION CHECKLIST:
- Script loads without blocking page rendering
- Compatible with existing build pipeline
- Works in both development and production environments
- Does not conflict with existing analytics or tracking
- Properly handles single-page application routing
VERIFICATION:
- window.affonso_referral should be globally accessible
- Script should respond to ?atp= URL parameters
- No console errors related to the tracking script
Please implement this affiliate tracking following these requirements.
Replace YOUR_PUBLIC_PROGRAM_ID with your actual Program ID.
Platform-Specific Troubleshooting
For React-based Lovable apps:
The tracking script needs to work with React. Please:
1. Add the script to public/index.html in the <head> section
2. Or use a Script component in the root App.js component
3. Ensure it doesn't get removed during hot reloads
4. Verify it works with React Router navigation
For full-stack applications:
This is a full-stack app with server-side rendering. Please:
1. Add the tracking script to the client-side template
2. Ensure it doesn't execute on the server side
3. Verify it loads after client-side hydration
4. Make sure it works with API routes and backend functionality
Testing Your Implementation
- Preview your application in Lovable
- Visit your app with
?atp=test
parameter - Open browser DevTools → Console
- Type
window.affonso_referral
- should return a tracking ID
Next Steps
Once installed, you can access affiliate referral data and pass it to your payment provider. Connect your payment provider →