Greasy Fork 还支持 简体中文。

Instagram Anti-Tracking (READ CAPTION ON GREASYFORK)

disable Instagram tracking

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Instagram Anti-Tracking (READ CAPTION ON GREASYFORK)
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  disable Instagram tracking
// @author       YourName
// @match        https://www.instagram.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Disable analytics tracking
    function disableAnalytics() {
        window.ga = function() { return null; };
        window.fbq = function() { return null; };
        window._paq = { push: function() {} };
    }

    // Disable specific tracking functions
    function disableTrackingFunctions() {
        const originalXHROpen = XMLHttpRequest.prototype.open;
        XMLHttpRequest.prototype.open = function(method, url) {
            if (url.includes('/ajax/bz') || url.includes('/logging_client_events')) {
                // Block requests to specific tracking endpoints
                console.log('Blocked tracking request:', url);
                return;
            }
            return originalXHROpen.apply(this, arguments);
        };

        const originalFetch = window.fetch;
        window.fetch = function(url, options) {
            if (typeof url === 'string' && (url.includes('/ajax/bz') || url.includes('/logging_client_events'))) {
                // Block fetch requests to specific tracking endpoints
                console.log('Blocked tracking request:', url);
                return new Promise((resolve, reject) => {
                    resolve(new Response('{}', { status: 200, statusText: 'OK' }));
                });
            }
            return originalFetch.apply(this, arguments);
        };
    }

    // Execute the functions to disable tracking
    disableAnalytics();
    disableTrackingFunctions();

    console.log('Instagram Anti-Tracking script has been activated.');
})();