Greasy Fork is available in English.
Remove unnecessary tracking parameters from Amazon product pages
当前为
// ==UserScript==
// @name Remove Amazon Tracking Parameters
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Remove unnecessary tracking parameters from Amazon product pages
// @author USForeign Policy
// @match https://www.amazon.com/*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
// Get the current URL
var currentURL = window.location.href;
// Check if the URL contains "/dp/" followed by a 10-character product code
var regex = /\/dp\/([A-Z0-9]{10})\//;
var match = currentURL.match(regex);
if (match) {
// Extract the 10-character product code
var productCode = match[1];
// Build the new URL without tracking parameters
var newURL = "https://www.amazon.com/dp/" + productCode;
// Replace the current URL with the new URL
window.history.replaceState({}, document.title, newURL);
}
})();