0

We are currently using the "old" Google Analytics (ga.js) with custom event tracking on our site (custom HTML, no CMS, 30-40 pages).

We are using this function:

   function recordOutboundLink(link, category, action, label) {
        _gat._getTrackerByName()._trackEvent(category, action, label);
        setTimeout('document.location = "' + link.href + '"', 100);}

in the header and add it with:

   onclick="recordOutboundLink(this, '...', '...', '...');

to the elements we want to track the clicks on. (Mainly outbound Links)

I recently set up a new property and added Universal Tracking. We are receiving data, but I played around with the event code, but nothing happens. We are using both the old ga.js and analytics.js as suggested by Google not to corrupt any data. Is there an "easy" way to adapt the new Universal Tracking Code to "accept"/use our existing function without changing all the code?

Any help appreciated.

4

1 回答 1

1

只需更新您的函数以将其发送到 Universal Analytics。

function recordOutboundLink(link, category, action, label) {
  _gat._getTrackerByName()._trackEvent(category, action, label);
  ga('send', 'event', category, action, label);
  setTimeout('document.location = "' + link.href + '"', 100);
}
于 2013-09-06T20:33:44.427 回答