Skip to content

Instantly share code, notes, and snippets.

@thedivtagguy
Created February 1, 2025 10:14
Show Gist options
  • Save thedivtagguy/57f80d5360bdc91ca70c29394dfd3884 to your computer and use it in GitHub Desktop.
Save thedivtagguy/57f80d5360bdc91ca70c29394dfd3884 to your computer and use it in GitHub Desktop.
Automatically adds udm=14 to google search results
// ==UserScript==
// @name Google Search UDM Parameter with Override
// @namespace http://tampermonkey.net/
// @version 1.1
// @description Automatically adds &udm=14 to Google searches with override options
// @author Your name
// @match *://www.google.com/*
// @match *://google.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
// Check if it's a search page and doesn't already have udm parameter
if (window.location.pathname === '/search') {
// Don't redirect if there's a 'noudm' parameter or if it already has udm=14
if (!window.location.href.includes('noudm') && !window.location.href.includes('udm=14')) {
const separator = window.location.href.includes('?') ? '&' : '?';
window.location.href = window.location.href + separator + 'udm=14';
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment