getLinkerUrl 不跨域传递 cookie - Google Analytics
我有一位客户正在使用链接到不同域上的预订引擎的表单。然而,可以这么说,他们没有使用传统编码的表单:
<div id="qs" align="center">
<div align="center"><img src="images/qs_title.gif" alt="Quick Search">
<table width="200" border="0" cellpadding="0" cellspacing="0">
<!--<form method="post">--><form method="post">
....
<td width="35%" valign="bottom"><div align="left"><a href="javascript:sendToCBE();"><img src="quicksearch/continue-buttom_dreams.gif" alt="Continue" width="83" height="24" border="0" ></a></div></td>
因为表单是由 JavaScript 文档 CBE 管理的,所以它是用 getLinkerURL 代码修改的:
// JavaScript Document
function popup_no_status(loc)
{
var windowW=1000
var windowH=700
s = "width="+windowW+",height="+windowH+",status=yes, resizable=yes, scrollbars=yes";
mywin = window.open(pageTracker._getLinkerUrl(loc), "CBE", s);
mywin.focus();
}
我被告知这应该有效,但事实并非如此似乎正在传递饼干。目标/域页面上确实有 pageTracker._setAllowLinker(true);
代码。但是,只有目标页面上有 setAllowHash(false);
代码。域 1(我想要传递 cookie 的域)是否也需要 setAllowHash(false);
代码?我不确定我在这里缺少什么。 cookie 没有被传递,所以我从第一个域获得了一个推荐 cookie。有什么想法吗?非常感谢所有的见解!
I have a client who is using a form that links to a booking engine on a different domain. However, they aren't using a traditionally coded form so to speak:
<div id="qs" align="center">
<div align="center"><img src="images/qs_title.gif" alt="Quick Search">
<table width="200" border="0" cellpadding="0" cellspacing="0">
<!--<form method="post">--><form method="post">
....
<td width="35%" valign="bottom"><div align="left"><a href="javascript:sendToCBE();"><img src="quicksearch/continue-buttom_dreams.gif" alt="Continue" width="83" height="24" border="0" ></a></div></td>
Because the form is being managed by the JavaScript Document CBE, that was modified with a getLinkerURL code:
// JavaScript Document
function popup_no_status(loc)
{
var windowW=1000
var windowH=700
s = "width="+windowW+",height="+windowH+",status=yes, resizable=yes, scrollbars=yes";
mywin = window.open(pageTracker._getLinkerUrl(loc), "CBE", s);
mywin.focus();
}
I've been told that this should work, but it doesn't seem to be passing the cookies along. The target/domain page does have the pageTracker._setAllowLinker(true);
code on it. However, only the target page has the setAllowHash(false);
code on it. Does Domain 1 (the domain I want to pass the cookies) need that setAllowHash(false);
code as well? I'm not sure what I'm missing here. The cookies aren't being passed along and so I'm getting a referral cookie from the first domain. Any ideas? All insight is much appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我是 stackoverflow 的新手,我对这个问题没有足够的声誉评论来澄清它,所以如果我违反了任何礼仪规则,我深表歉意,因为这更多的是尝试提供帮助,而不是实际的答案。
新弹出窗口的网址是否附加了额外的跟踪参数? Cookie 是根据这些参数创建的,因此如果没有发生这种情况,您需要修复。
如果它们存在,则可能是您在第二个域上的 GA 设置存在问题。
如果它们不存在,请添加:
console.log('loc: ' + loc');
后:
mywin = window.open(pageTracker._getLinkerUrl(loc), "CBE", s);
记录的 url 应附加跟踪参数。如果不是,那么您的问题出在第一个域上。
顺便说一句,我已经使用已弃用的 _setAllowHash 进行了跨域跟踪,并且它没有引起问题,所以我怀疑这是一个问题。
I'm new to stackoverflow and I don't have sufficient reputation comment on the question to clarify it so apologies if I'm breaking any etiquette rules as this is more of an attempt to help than an actual answer.
Does the new popup window's url have the additional tracking parameters appended to it? The cookies are created based on these parameters so if this is not happening that's what you need to fix.
If they are present, then it's probably an issue with your GA setup on the second domain.
If they're not present, add:
console.log('loc: ' + loc');
after:
mywin = window.open(pageTracker._getLinkerUrl(loc), "CBE", s);
The url which is logged should have the tracking parameters appended. If not then your issue is with the first domain.
BTW, I've done cross-domain tracking with the deprecated _setAllowHash present and it hasn't caused a problem so I doubt this is an issue.