简体   繁体   English

AdBlock阻止了我的jquery

[英]AdBlock blocking my jquery

Hi I am using uBlock Origin and it seems to be blocking this code I use for a div. 嗨,我正在使用uBlock Origin,它似乎正在阻止我用于div的代码。 I'm using a GA experiment to change the style of a div by the users variation. 我正在使用GA实验来通过用户变化来更改div的样式。

<script>
    if ($(window).width() > 768 && $('.book-now').length) {
        // Ask Google Analytics which variation to show the user.
        var chosenVariation = cxApi.chooseVariation();

        // Define JavaScript for each page variation of this experiment.
        var pageVariations = [
            function () {
                $('.menu').addClass('menu-widget');
            },
            function () {
                $('.menu').addClass('menu-custom');
            }
        ];

        // Wait for the DOM to load, then execute the view for the chosen variation.
        $(document).ready(
            // Execute the chosen view
            pageVariations[chosenVariation]
        );
    }
</script>



<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
<script>

    (function (i, s, o, g, r, a, m) {
        i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
            (i[r].q = i[r].q || []).push(arguments)
        }, i[r].l = 1 * new Date(); a = s.createElement(o),
            m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
    })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

    ga('create', 'UA-46138466-1', 'thehoxton.com');
    ga('send', 'pageview');
    ga('require', 'ecommerce', 'ecommerce.js');



</script>

Does AdBlock/uBlock block Google Analytics code or is there something with my JavaScript that allows it to be blocked by theres plugins? AdBlock / uBlock是否会阻止Google Analytics(分析)代码,或者我的JavaScript中有某些东西可以让它们被Theres插件阻止?

ABP does indeed block GA. ABP确实可以阻止GA。 Not sure about uBlock. 不确定uBlock。

There is a mock-up to work around ABP here . 有一个实体模型来解决ABP 这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM