Google Analytics 和 Google 跟踪代码管理器中的 AddThis 共享事件

AddThis Sharing Events in Google Analytics and Google Tag Manager

我在网站上安装了 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 中触发的。

我还尝试在 addThis 配置中使用额外选项 data_ga_social: true,但我也没有在 Google Analytics 中看到社交事件弹出。

来自 addthis 文档:

"Note that AddThis doesn’t currently support Google’s 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) {}
                }
            }
        }
    }