Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- /*
- * Remove Kartra analytics tracking parameters from link URLs.
- * Breaks Kartra tracking, but may be required if other software breaks.
- * For Kartra pages, add to body tracking.
- */
- function untrackLinks () {
- for (const link of document.querySelectorAll('a[href*="kref"]')) {
- const url = new URL(link.href), sp = url.searchParams;
- sp.delete('kref');
- sp.delete('kuid');
- url.search = sp.toString();
- link.href = url.toString();
- }
- }
- untrackLinks();
- (() => {
- const mo = new MutationObserver(mrs => {
- for (const mr of mrs) {
- if (mr.attributeName) {
- untrackLinks();
- return;
- }
- }
- });
- mo.observe(document.body, {
- subtree: true, childList: true, attributes: true,
- attributeFilter: [ 'href' ]
- });
- })();
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement