Support » Plugin: Freesoul Deactivate Plugins » FDP to deactivate GA and FB pixel codes from loading

  • Resolved calliesens


    Hi Jose! How are you?

    I would like to know if FDP is able to prevent Google Analytics and FB pixels from loading on selected webpages?

    I’d like to track both an English and Chinese version of my website (setup using WordPress + TranslatePress) – thereby making it multilingual.

    China blocks Google and Facebook so if GA and FB codes are on the webpage, the page will either load very slowly or may show timeout errors

    A proven solution online (I assumed it’s proven cos it’s from a company that does this for a living) states:


    “The issue here is that when a page loads the initiator file analytics.js, the domain ( is VERY slow. Given this typically loads at the end of page following DOM Complete, if a page doesn’t load fully, or if it loads slowly, then that library file/resource file analytics.js will never actually get a chance to load (and subsequently send some events to GA).

    The best case is to locally host that analytics.js file and recursively find and locally host all the other js files that may be loaded (assuming you’re using GTM perhaps), so that all the static JS files are hosted on your local domain. This eliminates the need to initiate sessions (i.e. TCP/SSL handshakes) with additional servers, and allows the API calls to trigger as per normal.”

    I have no idea what this means. But I think it means that if the files from GA are loaded, then this page will not load properly if the web visitor is from China.

    I obviously don’t know how to deal with all these JS stuff but I think a good compromise will be to have all my translated Chinese pages NOT load these files/codes from GA and FB.

    I’m adding GA to my website using a plugin called GA Pro and I’m adding FB pixel code to my website using a plugin called Pixel Caffeine. If I disable these 2 plugins on the Chinese pages using FDP, will this achieve what I want? How do I check if it’s successful?

    I’ve checked with the plugin author from GA Pro and he said it should work but he told me to double check with you as well 🙂

    Your advice is greatly appreciated. Thank you! 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jose


    Hi @calliesens
    I’m fine thank you! I hope you are fine too.

    If the Facebook Pixel is added to the pages via a plugin as in your case, on the pages where that plugin is disabled by Freesoul Deactivate Plugins, you will not have the Facebook Pixel. The same for Google Analytics scripts.
    So, if you disable those plugins on the Chinese pages, you will have no problems regarding the timeout given by the Chinese firewall.
    However, maybe you want to track also users who are not located in China who land on the Chinese pages, as e.g. Chinese speaking users who live out of China. If you disable those plugins on the Chinese pages, of course, you will not track them.

    The perfect solution would be disabling plugins according to the Geolocation.
    I mean disabling GA Pro if the page is visited by China, you would have the perfect solution.
    I have already thought to add the possibility to disable specific plugins by Geolocation, but this would be something that slows down all the pages, including those ones where you are not interested. Because in any case, you would check the location, and this would require the connection to an external database or server that gives this kind of service.
    It’s not possible to detect the location only by the user IP without making external requests.

    Probably in the future I will create an add-on that works with Freesoul Deactivate Plugins to disable plugins depending on the location, so only who really needs this functionality will install the add-on, that honestly, will slow down a little all pages. But if you really need it, you have no other solutions, and you solve bigger problems, why not.
    At the moment you can only disable plugins on specific pages, for everybody, no matter where they are located.

    If you think, most of the users who are interested in Chinese pages are from China, I suggest disabling GA Pro and Pixel Caffeine on the Chinese pages. You will not track any users for those pages, but you will be sure those scripts don’t cause timeout problems.

    I’m also not completely sure those scripts can cause problems if the Chinese firewall blocks them.
    Usually this kind of scripts are loaded asynchronously, which means they don’t block the page loading. I suppose the plugins you are using are loading the Facebook and Google Analytics scripts asynchronously. So the timeout should affect only the download of those scripts, not the entire page.
    I suggest you take more information about it from the plugins authors.

    As author of FDP, I can only say that if the scripts are introduced by plugins, disabling those plugins on a specific page, you will not have their scripts on that page. So in your case you would not track anybody on that page.

    For testing the pages, maybe you can use this service:

    And check the speed from China with this tool:

    If you measure the speed with the tool above, you will probably have a very high measured loading time, but you have to check the details of the waterfall. Probably you will see very high loading time for resources hosted on blocked domains, as e.g. the Google Analytics script, but in the end the page is already available and usable by the user after a normal time. So you should give the right interpretation for the results.
    You may have a loading time of 100 seconds, but the page ready in a couple of seconds, and the other 98 seconds are for waiting the Google script that will never arrive.

    The final test would be a real person that visits the page from China without any VPN, so really inside the Chinese firewall who can tell you if the page has no problems and how the impression of speed is.

    Thank you very much for the very detailed reply!! You’ve gone far and beyond again!!

    The perfect solution would be disabling plugins according to the Geolocation.
    I mean disabling GA Pro if the page is visited by China, you would have the perfect solution.

    Ohmygosh! YES! You are right!! And that will save thousands of people like me who are banging our heads against the wall over the issues the Great Firewall of China is causing. Cos for example, like GA, it has a lot of stuff like Google Ads, GTM, Global site tag etc and the thing is, the stuff that’s being blocked changes.

    I’m not running some kinda MNC so I just need some analytical results to optimize my site further. If GA is going to cause such instability for China web visitors, it will make so much more sense to just disable it in the first place if the visitor is from China.

    I have already thought to add the possibility to disable specific plugins by Geolocation, but this would be something that slows down all the pages, including those ones where you are not interested.

    Such great foresight! hahaha but assuming a plugin like this is available, if the geolocation function only applies to the Chinese webpages and not the rest + the slowdown isn’t that bad, it sounds like it would be a perfect solution indeed!

    I recently came across a plugin called If-So which adds or replaces content according to the visitor’s profile or interaction with the site. It also has geolocation capabilities and the slowdown isn’t obvious to me so I look very much forward to your geolocation addon when it’s out!!

    And you really should consider starting a course that teaches WordPress or something to beginners. I think you will make a fantastic instructor. Your explanations are always well thought-out, detailed and easy to understand. If you really do that in future, please let me know. I’ll recommend your course to my university’s curriculum department.

    Thank you again and have a wonderful day!

    Plugin Author Jose


    Hi @calliesens
    thank you very much!

    In the future I think I will create this add-on, I can’t say when because I already have other projects, but it’s in my list.

    Thank you so much also for your idea about a course. This was also something I wanted to do but never had time. This is also in my list 🙂
    When I create a course, I will surely let you know it.

    Have a wonderful day!

    I’ve been looking for something like this too.
    Specifically with Facebook Pixel, I’d like a way to NOT activate the “Official FaceBook Pixel Plugin” when a page is opened in China.

    I can appreciate the performance impact if the page needs to call an external IP address geolocation database.

    I’d like to suggest a solution though.
    These guys sell an IP Address Geolocation CSV (or BIN) file on an annual subscription ($49).

    I wonder if YOUR plugin could have an option to upload a geolocation CSV file that can be checked against. THAT would reduce the processing load, wouldn’t it?

    Users would of course need to purchase the CSV file (I believe updates are provided by IP2Location under their subscription plan).

    FOLLOW UP QUESTION: I need a solution like this for a WordPress MultiSite Network. Is that something we can discuss?

    Plugin Author Jose


    Hi @twd thank you for your interest and ideas.

    As said this add-on is in my list of future projects, but it has a lower priority than other projects at the moment.

    A request to an external server is time consumed, but also reading a very big file, even if it’s hosted on the same server. Also increasing the database size putting all the needed information would give issues.

    In any case, when I make this add-on I will test all possible methods to see which one is better in terms of performance. I feel confident it will be a way to minimize the performance loss.

    But you have also to take into account the problems with the server cache plugins. If you need to check the Geo-Location via PHP code, you can’t do it after the cached page is already called, so, I expect some work to make it compatible with all cache plugins.

    About the Multisite installation, I don’t think it will be a big problem.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.