我的网站上有Google跟踪代码管理器。
我将addthis代码硬编码到站点中(即未通过GTM实现):
<script type="text/javascript">
var addthis_config = {data_ga_property: 'UA-4035505-1'};
</script>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=XXXX" async="async"></script>
但是,我没有在Google Analytics(分析)中看到任何addThis事件。根据他们的文档,我应该看到eventCategory
设置为的事件addThis
。但是他们不在那里。我不知道addThis如何将事件推送到Google Analytics(分析)(即它是试图利用analytics.js
网站上的代码还是以某种方式使用其自身的方法)。我怀疑它失败了,因为如果确实要使用analytics.js
代码,那么就不会成功,因为GA标签是从GTM内部触发的。
我也尝试data_ga_social: true
在addThis
配置中使用额外选项,但我也没有看到社交事件在Google Analytics(分析)中弹出。
从addthis文档中:
“请注意,AddThis当前不支持Google的Universal Analytics”。
这似乎是其小部件代码的相关部分,实际上,它仍然使用不推荐使用的_gaq对象:
function x(e, t, n, r) {
if ("facebook_unlike" != e && "google_unplusone" != e) {
n = n || {};
var o = n.data_ga_tracker,
a = n.data_ga_property;
if (a && ("object" == typeof window._gat && _gat._createTracker ? o = _gat._createTracker(a, "addThisTracker") : "object" == typeof window._gaq && _gaq._getAsyncTracker ? o = _gaq._getAsyncTracker(a) : window._gaq instanceof Array && _gaq.push([function() {
_ate.gat(e, t, n, r)
}])), o && "string" == typeof o && (o = window[o]), !o && window.GoogleAnalyticsObject) {
var i = window[window.GoogleAnalyticsObject];
i.getAll && (o = i.getAll())
}
if (o && "object" == typeof o) {
if ("more" == e || "settings" == e) return;
var s = t || (r || {}).url || location.href,
c = e,
u = "share";
c.indexOf("_") > -1 && (c = c.split("_"), u = c.pop(), u.length <= 2 && (u = "share"), c = c.shift()), 0 == s.toLowerCase().replace("https", "http").indexOf("http%3a%2f%2f") && (s = _duc(s));
try {
n.data_ga_social && o._trackSocial && "google_plusone" != e ? o._trackSocial(c, u, r.url) : o._trackEvent ? o._trackEvent("addthis", e, s) : n.data_ga_social && "google_plusone" != e ? i("send", "social", c, u, s) : i("send", "event", "addthis", e, s)
} catch (l) {
try {
o._initData && o._initData(), n.data_ga_social && o._trackSocial && "google_plusone" != e ? o._trackSocial(c, u, r.url) : o._trackEvent ? o._trackEvent("addthis", e, s) : n.data_ga_social && "google_plusone" != e ? i("send", "social", c, u, s) : i("send", "event", "addthis", e, s)
} catch (l) {}
}
}
}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句