A Chrome extension that automatically manages Amazon affiliate links and tracks purchases to award points based on order value.
- Automatically replaces Amazon links with your affiliate links
- Works across multiple Amazon domains (amazon.com, amazon.in, amazon.co.uk, amazon.ca)
- Smart URL cleaning:
- Preserves essential parameters (node, keywords, product IDs)
- Removes tracking and unnecessary parameters
- Maintains clean, functional URLs
- Dynamic content handling:
- Monitors page changes using MutationObserver
- Processes new links added through AJAX or infinite scroll
- Real-time updates without page refresh
- Detects when user is on a checkout page
- Extracts and stores:
- Product descriptions from page text content
- Order total in USD
- Session ID and timestamp
- Continuously monitors the page for:
- New product descriptions
- Changes in order total
- Updates stored data when changes are detected
- Detects Amazon thank you pages
- Verifies:
- Correct affiliate tag
- Page is fully loaded
- Purchase hasn't been processed before (using content hash)
- Extracts:
- Product descriptions from image alt texts
- Order confirmation content for hashing
- Matches product descriptions between:
- Checkout page (stored text content)
- Thank you page (image alt texts)
- Validates:
- Session is less than 30 minutes old
- At least one product description matches
- Order total is within valid range
- Awards points based on order total:
- 100 points per USD
- Minimum: 100 points
- Maximum: 10,000 points
- Maximum order value: $1,000 USD
project/
├── extension/
│ ├── manifest.json # Extension configuration
│ ├── config.js # Associate ID configuration
│ ├── popup.html # Extension popup interface
│ ├── popup.js # Popup logic
│ └── content.js # Core functionality
│
├── backend/
│ ├── app.py # Flask server implementation
│ ├── requirements.txt # Python dependencies
│ ├── .env # Environment configuration
│ └── .env.example # Environment template
- Prevents duplicate points:
- Generates unique hash for each purchase
- Stores processed hashes with timestamps
- Cleans up old hashes after 24 hours
- Validates affiliate tags
- Enforces session timeouts
- Secure user authentication:
- JWT token authentication
- Protected user profiles
- Points data security
- URL Parameter Management:
- Preserved: node, th, keywords, dp, psc
- Removed: tracking and unnecessary parameters
- Content Matching:
- Checkout page: Extracts meaningful text content
- Thank you page: Extracts product descriptions from image alt texts
- Uses fuzzy matching to validate purchases
- Currency Handling:
- Supports multiple currencies (INR, USD, EUR, GBP, BRL)
- Automatically converts to USD for points calculation
- Uses current exchange rates
- Uses chrome.storage.local for:
- Session data
- Checkout information
- Temporary storage
- Uses chrome.storage.sync for:
- Processed purchase hashes
- User preferences
- Long-term data
- Implements fallback mechanisms for storage failures
-
Configure Backend:
- Install Python dependencies:
pip install -r requirements.txt - Configure environment variables in
.env - Start backend server:
python app.py
- Install Python dependencies:
-
Configure Extension:
- Open
config.js - Set your Amazon Associate ID
- Update backend URL if needed
- Open
-
Load Extension:
- Open Chrome Extensions (chrome://extensions/)
- Enable "Developer mode"
- Click "Load unpacked"
- Select the extension directory
- Built with vanilla JavaScript
- Uses Chrome Extension Manifest V3
- Implements MutationObserver for dynamic content
- Backend built with Flask
- MongoDB for data storage
- JWT for authentication
-
Configuration:
- Keep Associate ID in config.js
- Secure backend credentials
- Update manifest for new domains
- Test after configuration changes
-
Usage:
- Let automatic updates work
- Use check button to verify
- Monitor status messages
- Keep user logged in
-
Security:
- Regular security audits
- Token rotation
- Secure password storage
- Rate limiting
- Input validation