0

我在 Drupal 站点中安装了 Google Analytics 模块。这会跟踪任何自然的流量来源(来自谷歌搜索)。但是,我们正在使用第三方电子商务平台来处理预订信息。这会跟踪交易但不跟踪流量来源——如果原始网站有自然或付费流量来源,第三方网站只会认为流量是来自原始网站的引荐。

这是原始网站中的 GA 代码 - callawaygardens.com

var _gaq = _gaq || [];_
gaq.push(["_setAccount", "UA-1162555-1"]);_
gaq.push(["_setDomainName", "none"]);
_gaq.push(["_setAllowLinker", true]);
_gaq.push(['_setDomainName', 'callawaygardens.com']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(["_trackPageview"]);

(function() {var ga = document.createElement("script");ga.type = "text/javascript";ga.async = true;
ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(ga, s);})();

这是第三方预订网站中的代码:var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-1162555-1']); _gaq.push(['_setDomainName', '.synxis.com']); _gaq.push(['_setAllowLinker', true]); _gaq.push(['_trackPageview', '确认']); _gaq.push(['_addTrans', '18174SB007366', // 订单 ID - 需要 'Callaway Gardens Resort', // 附属机构或商店名称 '119.00', // 总计 - 需要 '15.47', // 税 '', // shipping 'New York', // 城市 'NY', // 州或省 'US' // country ]);

   // add item might be called for every item in the shopping cart
   // where your ecommerce engine loops through each item in the cart and
   // prints out _addItem for each
  _gaq.push(['_addItem',
    '18174SB007366',                     // order ID - required
    'IMND - BA12',      // SKU/code - required
    'Mountain Creek Inn Double ',                      // product name
    'Best Available Rate',                      // category or variation
    '119.00',                     // unit price - required
    '1'                  // quantity - required
  ]);
  _gaq.push(['_trackTrans']);


  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
4

1 回答 1

0

由于您没有提及它们,您可能忘记使用 _link 或 _linkByPost 函数。仅仅允许 GA 代码中的链接是不够的,您必须明确地将 cookie 数据发送到其他域。

文档在这里: https ://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiDomainDirectory#_gat.GA_Tracker_._linkByPost

更新添加:

至于 Drupal 模块——我已经有一段时间没有使用 Drupal,所以我不确定。但从代码来看,_link 方法(适用于指向其他域的链接)似乎是自动附加的,而 _linkByPost-Data(适用于表单)根本没有实现。因此,如果您通过表单将访问者发送到其他域,这将不起作用。

其他想法:您的网站和其他域之间可能存在重定向?在这种情况下,您必须确保重定向不会丢失通过链接器方法添加的数据。

于 2013-03-05T08:46:32.093 回答