Skip to content

Instantly share code, notes, and snippets.

@titangene
Last active August 27, 2023 02:35
Show Gist options
  • Save titangene/6b74649626d6d07fd86242473fb825b8 to your computer and use it in GitHub Desktop.
Save titangene/6b74649626d6d07fd86242473fb825b8 to your computer and use it in GitHub Desktop.
Remove the tracking query from the URL
(function() {
const params = [
'utm_term',
'utm_source',
'utm_medium',
'utm_content',
'utm_campaign',
'up_id',
'unique_k',
'timestamp',
'source',
'share_tag',
'share_source',
'share_session_id',
'share_plat',
'share_medium',
'share_from',
'ref',
'plat_id',
'p',
'mid',
'is_story_h5',
'hc_ref',
'fbclid',
'eid',
'doing_wp_cron',
'ck_subscriber_id',
'buvid',
'__tn__'
];
const url = new URL(location);
params.forEach(param => url.searchParams.delete(param));
history.replaceState(null, '', url.href);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment