Greasy Fork is available in English.

TrackingTokenStripper

Remove most of the annoying tracking token from URL parameters

Ниже показаны версии этого скрипта, в которых изменялся код. Показать все версии.

  • вер. 1.425.11.2024

    New Features:

    1. Enhanced URL Parsing and Handling:

      • Introduced new URL(url) for parsing and manipulating URLs, ensuring compatibility and robustness.
      • Added specific logic to handle domain-specific URL parameters.
    2. Domain-Specific Parameter Removal:

      • removeByDomain(domain, name) function added for removing tracking tokens specific to particular domains.
      • Examples include:
        • Facebook: privacy_mutation_token, acontext, notif_t, etc.
        • Dropbox: _ad, _camp, _tk.
        • YouTube: si.
        • Microsoft: ocid, ef_id, etc.
    3. Event Listeners for URL Changes:

      • Monitors history state changes using replaceState and popstate events.
      • Added custom locationchange event to handle URL changes dynamically.
    4. Automatic Execution Control:

      • Introduced setInterval to periodically execute token stripping for dynamic pages.
      • Stops interval after 2000ms to avoid unnecessary resource usage.
    5. Improved TrackingTokenStripper Functionality:

      • Supports both general parameter removal and domain-specific parameter removal with optional value matching.

    Changes:

    1. Refactored Code Structure:

      • Simplified and modularized the logic for better readability and maintenance.
      • Replaced the initial query string manipulation logic with the URLSearchParams API for cleaner and safer parameter handling.
    2. Improved Performance:

      • Replaced location.href reassignments with history.replaceState to update the URL without triggering full-page reloads.
      • Minimizes unnecessary network requests and enhances user experience.
    3. More Tracking Tokens Supported:

      • Added numerous new tracking tokens across various domains, including:
        • Microsoft (wt.mc_id, ocid, redirectedfrom).
        • Bilibili (share_source, share_medium).
        • Yahoo News (guce_referrer, guce_referrer_sig).
        • SendGrid (mc, mcd, cvosrc).
        • Google Analytics (utm_id, _ga, etc.).
    4. Updated Domain Matching Logic:

      • Case-insensitive matching for domains and query parameter names to ensure reliability.
    5. Additional Logs (Commented Out):

      • Included optional console.log statements for debugging URL changes (commented out for production).

    Bug Fixes:

    1. Fixed Edge Case with Empty Query Strings:

      • Improved handling when query strings are empty to avoid unnecessary characters (? or #).
    2. Corrected Parameter Name and Value Parsing:

      • Fixed issues when parsing query parameters with = in their values.
    3. Resolved Compatibility Issues:

      • Ensured compatibility across modern browsers by utilizing native URL and URLSearchParams APIs.
    4. Reduced Unintended URL Changes:

      • Implemented strict conditions to only modify the URL when necessary.

    Deprecations:

    • Removed the remove(name) method from the original implementation that manually iterated query parameters. Replaced with the URLSearchParams-based method for better efficiency and accuracy.

    General Notes:

    • This update significantly improves the script's capability to handle dynamic and domain-specific tracking tokens.
    • The logic has been enhanced to cover additional use cases and tracking mechanisms found on popular platforms.
  • вер. 1.025.08.2020