您好,我正在使用 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/