Remove twitter analytics

Remove twitter anayltics button under tweets.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Remove twitter analytics
// @namespace    https://kem.ooo/
// @version      1.1
// @description  Remove twitter anayltics button under tweets.
// @author       Kem0x
// @license      MIT
// @match        *://*twitter.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var observer = new MutationObserver(function(mutations) {
        document.querySelectorAll("[d]").forEach(e => {
            if (e.getAttribute("d") == "M8.75 21V3h2v18h-2zM18 21V8.5h2V21h-2zM4 21l.004-10h2L6 21H4zm9.248 0v-7h2v7h-2z")
            {
                const elm = e.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
                // alert(elm.children[0]);
                if(elm.children[0].getAttribute("href") && elm.children[0].getAttribute("href").includes("analytics"))
                {
                    elm.parentNode.removeChild(elm);
                }
            }
        });
    });

    observer.observe(document, {attributes: false, childList: true, characterData: false, subtree:true});
})();