Replit allows you to build and deploy web applications directly in the browser using various frameworks and languages. To add Affonso tracking to your existing Replit project, use the optimized prompt below.
Prompt
Use Replit's AI assistant or modify your project with this specification:
Add Affonso.io affiliate tracking to this web application with the following requirements:
TRACKING SCRIPT TO ADD:
<script async defer src="https://affonso.io/js/pixel.min.js" data-affonso="YOUR_PUBLIC_PROGRAM_ID" data-cookie_duration="30"></script>
IMPLEMENTATION BY FRAMEWORK:
FOR HTML/STATIC SITES:
- Add script to <head> section of index.html or main HTML file
- Place before closing </head> tag
- Ensure it loads on all pages
FOR FLASK/PYTHON:
- Add script to base template (base.html or layout.html)
- Place in {% block head %} or <head> section
- Ensure template inheritance includes the script
FOR EXPRESS/NODE.JS:
- Add script to main template file (index.ejs, index.hbs, etc.)
- Place in <head> section of layout template
- Ensure all routes render with this template
FOR REACT APPS:
- Add script to public/index.html in <head> section
- Or use a script component in App.js root component
- Ensure compatibility with React Router
REQUIREMENTS:
- Script must be accessible on all pages/routes
- Use async defer attributes for performance
- Must work in Replit's hosting environment
- Should not conflict with existing dependencies
- Compatible with Replit's build and deployment process
Please implement this tracking script based on the project's framework.
Replace YOUR_PUBLIC_PROGRAM_ID with your actual Program ID.
Framework-Specific Troubleshooting
For Python/Flask applications:
Add tracking script to Python Flask app:
1. Locate your main template file (usually templates/base.html)
2. Add the script in the <head> section
3. Ensure all other templates extend this base template
4. Verify script loads when app is running on Replit
For Node.js/Express applications:
Add tracking to Express app:
1. Find your view engine template (EJS, Handlebars, Pug, etc.)
2. Add script to the main layout template
3. Ensure all routes use this layout
4. Test script loads on all endpoints
For Static HTML sites:
Add tracking to static HTML site:
1. Add script to <head> section of index.html
2. If multiple HTML files, add to each one
3. Or create a shared header include file
4. Verify script loads when site is deployed
Testing Your Implementation
- Run your application in Replit (click the "Run" button)
- Visit your app URL with
?atp=test
parameter - Open browser DevTools → Console
- Type
window.affonso_referral
- should return a tracking ID - Test different pages/routes to ensure universal loading
Next Steps
Once installed, you can access affiliate referral data and pass it to your payment provider. Connect your payment provider →