javascript - AdBlock 阻止我的 jquery

标签 javascript jquery html css google-analytics

您好,我正在使用 uBlock Origin,它似乎阻止了我用于 div 的代码。我正在使用 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>

AdBlock/uBlock 是否会阻止 Google Analytics 代码,或者我的 JavaScript 中是否有某些内容允许其被插件阻止?

最佳答案

ABP 确实会阻止 GA。不确定 uBlock。

有一个模型可以围绕 ABP here .

关于javascript - AdBlock 阻止我的 jquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32230055/

相关文章:

HTML 5 结构标签演示

html - div 内的 CSS 中心内容

javascript - 如何在 Xampp 上安装 Node.js 或 npm

javascript - 当 div 的数据属性之间存在空格时,产品过滤无法正常进行

javascript - jQuery 多个 AJAX 同步请求&动态添加 html 和事件

html - 我不知道如何阻止 margin-top 让我的 child div 溢出它的 parent

javascript - 在 React Native 中根据时间轴绘制移动加速度计的实时数据

javascript - jqGrid 查询中的子句

javascript - Jquery 在表行中的两个类之间切换

javascript - iframe 引入的 jQuery 播放器不会自动播放,但会弹出