Skip to content

Fasthrough/Ecom-Sentinel

Repository files navigation

E-Com Sentinel

🛡️ A Chrome extension designed to analyze online shopping risks on platforms like Shopee using AI. It provides users with a quantitative Trust Score and highlights common issues found in 1-star reviews, helping them make safer purchasing decisions.

✨ Features

  • AI-Powered Analysis: Leverages the Google Gemini API to analyze 1-star review text.
  • Risk Classification: Identifies specific risk categories: NonDelivery, Counterfeit, WrongItem, Damaged.
  • Bayesian Trust Score: Calculates a quantitative Trust Score using a hybrid Bayesian average formula, combining star ratings and AI-identified risks.
  • Risk Level Indication: Provides clear "Low", "Medium", or "High" risk labels based on the Trust Score.
  • On-Page Summary: Displays a concise summary and risk level directly on the product page via a non-intrusive banner (with minimize option).
  • Detailed Popup Analytics: Offers a detailed view in the extension popup, including:
    • A short, one-sentence summary of 1-star reviews.
    • Sentiment analysis of 1-star reviews.
    • A visual horizontal bar chart showing the top 3 identified issues.
    • Original product star rating and total review count.
  • Caching: Caches analysis results locally to avoid repeated API calls for the same product within a time window.
  • Privacy Focused: Only analyzes publicly visible review data; no personal user data is collected or transmitted.

🛠️ Technologies Used

  • JavaScript (ES6+): Core logic for content scripts, background script, and popup.
  • HTML5: Structure for the popup UI.
  • CSS3: Styling and layout, including flexbox and animations.
  • Chrome Extension APIs: For content injection, background processing, popup, storage, and messaging.
  • Google Gemini API: For AI-powered review analysis and classification.
  • Git: Version control.

📦 Installation

Prerequisites: A Google Chrome browser.

  1. Download: Click the green "Code" button on this repository and select "Download ZIP".
  2. Extract: Unzip the downloaded file to a folder on your computer (e.g., e-com-sentinel-main).
  3. Open Chrome: Launch Google Chrome.
  4. Navigate to Extensions: Type chrome://extensions in the address bar and press Enter.
  5. Enable Developer Mode: Toggle the "Developer mode" switch in the top-right corner.
  6. Load Unpacked: Click the "Load unpacked" button.
  7. Select Folder: Navigate to and select the extracted folder (e.g., e-com-sentinel-main).
  8. Install: The extension should now appear in your list of extensions.

🔐 API Key Configuration (Important!)

Warning

This step is crucial for the extension to work.

  1. Obtain an API Key: Visit Google AI Studio and create an API key for the Gemini API.
  2. Edit background.js: Inside the extracted folder, open the background.js file in a text editor (like Notepad, VS Code, etc.).
  3. Find the API Key Line: Look for the line containing const GEMINI_API_KEY = "YOUR_API_KEY_HERE";.
  4. Replace the Placeholder: Replace "YOUR_API_KEY_HERE" with your actual Google Gemini API key.
    const GEMINI_API_KEY = "your_actual_api_key_here";
  5. Save the File: Save the changes to background.js.
  6. Reload Extension: Go back to chrome://extensions, find E-Com Sentinel, and click the "Reload" button (or press Ctrl+R on the extensions page).

The extension is now ready to use.

🎯 Usage

  1. Navigate to a product page on Shopee (or any supported platform if the script is adapted).
  2. The extension will automatically start analyzing the 1-star reviews (if enabled).
  3. A banner will appear at the top of the page showing the risk level, a short summary, and the Trust Score.
  4. Click the extension icon in the Chrome toolbar to open the popup for detailed analytics.

🚀 How It Works

  1. Data Fetching: The page-context-script.js fetches 1-star review text from the Shopee product page API.
  2. Data Processing: The content.js script receives this data and sends it to the background.js script.
  3. AI Analysis: The background.js script uses the Google Gemini API to:
    • Classify review text into risk categories (NonDelivery, Counterfeit, etc.).
    • Generate a short summary of the 1-star reviews.
  4. Trust Score Calculation: A Bayesian formula is applied, combining the product's overall star rating, the number of reviews, and the severity/quantity of issues found by the AI in 1-star reviews.
  5. UI Display: The calculated Trust Score, risk level, summary, and top issues are sent back to content.js (for the page banner) and stored locally for the popup (popup.html, popup.js).
  6. Caching: The analysis results are cached using chrome.storage.local for the current product URL.

About

Analyzes Shopee reviews using AI to detect potential risks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors