Add email and ad click identifiers to globalRules

Covers the open part of #171 by @vigneshrajarr (_hsmi; _hsenc is already in globalRules) and the _kx part of #219 by @mkbloke.

Prerequisites

  • This rule only prevents tracking.
  • This rule does not destroy the function of the page.

Description

Email service providers and ad networks append a per-recipient or per-click identifier to every link. These ids tie the visit to a person or a click, they are not needed to show the page. Each name below is documented by the vendor itself as a tracking or attribution parameter:

Parameter Purpose Vendor documentation
_hsmi HubSpot marketing email click tracking https://knowledge.hubspot.com/email/links-in-emails-or-ctas-lead-to-an-error-page
hsa_acc, hsa_ad, hsa_cam, hsa_grp, hsa_kw, hsa_mt, hsa_net, hsa_src, hsa_tgt, hsa_ver HubSpot ads tracking https://knowledge.hubspot.com/ads/track-and-report-on-google-ads-in-hubspot
_kx Klaviyo email and SMS click identification https://help.klaviyo.com/hc/en-us/articles/115005248128
_cio_id Customer.io person id appended to tracked links https://docs.customer.io/messaging/channels/links/tracking/
ajs_uid, ajs_aid, ajs_event, ajs_prop_*, ajs_trait_* Twilio Segment querystring API https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/querystring/
sh_kit Kit (ConvertKit) cross-site subscriber attribution https://help.kit.com/en/articles/9375532-global-advanced-tracking
spMailingID, spUserID, spJobID, spReportId Acoustic Campaign (Silverpop) email ids https://help.goacoustic.com/hc/en-us/articles/360050002814
omnisendContactID Omnisend contact id https://api-docs.omnisend.com/v3/reference/carts
at_recipient_id, at_recipient_list Piano Analytics (AT Internet) email recipient https://developers.atinternet-solutions.com/as2-tagging-en/javascript-en/campaigns-javascript-en/marketing-campaigns-v2/
trk_msg, trk_contact Listrak message and contact ids https://help.listrak.com/en/articles/1772519-why-are-my-messages-showing-no-revenue
ttclid TikTok click id https://ads.tiktok.com/help/article/tiktok-click-id?lang=en
li_fat_id LinkedIn first-party click id https://learn.microsoft.com/en-us/linkedin/marketing/conversions/enabling-first-party-cookies
gbraid, wbraid Google Ads click ids for iOS (counterparts of the existing gclid) https://support.google.com/google-ads/answer/10417364?hl=en

The names are specific enough not to collide with functional parameters: every rule matches the whole key, and the prefixed groups (hsa_, ajs_, sp, trk_, at_recipient_) are spelled out instead of using a wildcard. The existing globalRules exceptions keep applying.

Not included on purpose:

  • source from #219: a generic name used by many sites for real content.
  • Click-tracking redirects such as trk.klclick.com/ls/click?upn=… from #219: the destination is encoded on the server and cannot be extracted offline.
  • _bhlid (Beehiiv): already proposed on the GitHub mirror in GitHub PR 190 by @alvincrespo.

Affected fields

  1. rules of globalRules, appended at the end

Change in data.min.json (globalRules.rules, appended)

[
    "(?:%3F)?_hsmi",
    "(?:%3F)?hsa_(?:acc|ad|cam|grp|kw|mt|net|src|tgt|ver)",
    "(?:%3F)?_kx",
    "(?:%3F)?_cio_id",
    "(?:%3F)?ajs_(?:uid|aid|event|prop_[a-z0-9_]+|trait_[a-z0-9_]+)",
    "(?:%3F)?sh_kit",
    "(?:%3F)?sp(?:MailingID|UserID|JobID|ReportId)",
    "(?:%3F)?omnisendContactID",
    "(?:%3F)?at_recipient_(?:id|list)",
    "(?:%3F)?trk_(?:msg|contact)",
    "(?:%3F)?ttclid",
    "(?:%3F)?li_fat_id",
    "(?:%3F)?[gw]braid"
]

Example URLs

URL Result
https://shop.example.com/item?id=7&_hsmi=Abc123&color=red#top https://shop.example.com/item?id=7&color=red#top
https://shop.example.com/item?_kx=Q%3D.x&id=7 https://shop.example.com/item?id=7
https://shop.example.com/item?id=7&spMailingID=Abc123&color=red#top https://shop.example.com/item?id=7&color=red#top
https://shop.example.com/item?id=7&gbraid=Abc123&color=red#top https://shop.example.com/item?id=7&color=red#top
https://shop.example.com/item?id=7&kx=Abc123&color=red#top unchanged, other parameter
https://shop.example.com/item?id=7&sp=Abc123&color=red#top unchanged, other parameter
https://shop.example.com/item?id=7&trk_id=Abc123&color=red#top unchanged, other parameter
https://github.com/org/repo/issues?q=x&_hsmi=1 unchanged, globalRules exception

Testing

Tested offline in URL Check 3.5 (Android 15 emulator), which applies this catalog with Java regexes: 33 of 33 parameter cases as expected (every new name removed in 20 cases, 12 similar names kept, 1 globalRules exception kept), 50 of 50 together with the two companion changes. Without the change none of the 20 parameters is removed. Inputs up to 160 KB (long hosts, many parameters, long tokens) took at most 10 ms per pattern in Java and 8 ms in JavaScriptCore, with no stack overflow at a 512 KB thread stack.

Companion MRs: !88 (LinkedIn redirections), !89 (instagram and vk.com redirections). The three change different fields and merge without conflict in any order.

AI-Assisted-By: Claude Opus 5.5 (xhigh)

Edited by Milan

Merge request reports

Loading
Loading