Goodreads: strip Amazon affiliate tags
Cleans Amazon buy links of their affiliate and tracking parameters.
Code to copy
// Strip affiliate tags from outgoing Amazon buy links
function cleanAffiliate() {
document.querySelectorAll('a[href*="amazon."]').forEach(function (a) {
try {
var u = new URL(a.href, location.href);
['tag', 'ascsubtag', 'linkCode', 'camp', 'creative'].forEach(function (p) {
u.searchParams.delete(p);
});
a.href = u.toString();
} catch (e) {}
});
}
cleanAffiliate();
window.setTimeout(cleanAffiliate, 1500);
How to use this example
- Copy the code with the button above.
- Install JustZix (2 minutes) and open the extension on the target page.
- Add a new rule matching that page.
- Paste the code into the rule's JavaScript panel and save — it runs on every page visit.
Rate this example
No ratings yet — be the first.