I have Google Tag Manager on the site.
I have the addthis code hardcoded into the site (i.e. not implemented via 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>
However I am not seeing any addThis events in Google Analytics. According to their documentation, I should see events with the eventCategory
set to addThis
. However they aren't there. I don't know how addThis pushes events to Google Analytics (i.e. whether it is trying to utilize the analytics.js
code on the site or uses its own method somehow). I suspect it is failing because if it is indeed trying to use analytics.js
code it can't since the GA tag is being fired from within GTM.
I've also tried to use the extra option data_ga_social: true
in the addThis
config but I am also not seeing social events pop up in Google Analytics.
From the addthis documentation:
"Note that AddThis doesn’t currently support Google’s Universal Analytics".
This seems to be the relevant part of their widget code, and indeed it still uses the deprecated _gaq object:
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) {}
}
}
}
}