Google Analytics(分析)似乎没有跟踪我们网站上的任何数据。运作方式;
标签助理说:
缺少Analytics.js脚本 和 未检测到HTTP响应
尝试了多种方法,还在正文中使用了代码,获得了不同类型的跟踪等。Als尝试添加
当前使用的代码:
<!-- Global site tag (gtag.js) - Google Ads: 991964869 -->
<script data-cfasync="false" async src="https://www.googletagmanager.com/gtag/js?id=AW-991964869-1"></script>
<!-- Cross domain checking for the ticket sale cms-->
<script data-cfasync="false">
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-37890526-1');
</script>
<script type="text/javascript" data-cfasync="false">
(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', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-37890526-1', 'auto');
ga(function (tracker) {
var clientId = tracker.get('clientId');
var frameWindow = document.getElementById('cm-ticketshop').contentWindow;
window.addEventListener('message', function (event) {
if (event.origin === "pos.cmtickets.com" && event.data === "shop.loaded") {
frameWindow.postMessage({
clientId: clientId
}, '*');
}
});
});
</script>
<!-- Cross domain checking for the ticket sale cms -->
<!-- Facebook Pixel Code -->
<script>
! function (f, b, e, v, n, t, s) {
if (f.fbq) return;
n = f.fbq = function () {
n.callMethod ?
n.callMethod.apply(n, arguments) : n.queue.push(arguments)
};
if (!f._fbq) f._fbq = n;
n.push = n;
n.loaded = !0;
n.version = '2.0';
n.queue = [];
t = b.createElement(e);
t.async = !0;
t.src = v;
s = b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t, s)
}(window, document, 'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '324909954561696');
fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=324909954561696&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
想要跟踪工作! :(
答案 0 :(得分:1)
确保您只复制粘贴Google Analytics(分析)API提供的代码,我将以下代码粘贴到index.html文件的<head></head>
标签内的最后一个标签中,并了解其工作和跟踪数据
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-134123456-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-134123456-1');
</script>