GA 不跟踪 Google Search Appliance 子域

发布于 2024-10-16 18:27:06 字数 1352 浏览 1 评论 0原文

我一直在使用 Urchin 6,但也刚刚开始使用 Google Analytics。我还使用 Google Search Appliance 进行网站搜索。

搜索位于子域上,即 www.search.mysite.com

问题是 Google Analytics 将网站搜索作为自我推荐进行跟踪。经过大量在线阅读后,我最终得到了下面的 GA 代码配置,它应该选择搜索子域,但事实并非如此。谁能看到我的配置有什么不正确的地方吗? - 例如,GATC 请求流程顺序是否正确

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-xxxxxx-1']);
  _gaq.push(['_setLocalRemoteServerMode']);
  _gaq.push(['_setLocalGifPath', '/__utm.gif']);
  _gaq.push(['_setDomainName', 'mysite.com]);  
  _gaq.push(['_addIgnoredRef', 'mysite.com']);  
  _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);
  })();

</script>

我怀疑问题可能在于 Google Search Appliance 上的 GA 配置。当您添加 GA 时,它只要求 XSLT 上的 UA 代码,然后您在每个搜索页面上发送以下脚本:

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script><script type="text/javascript">
     <!--
  _uacct = "UA-xxxxxxx-1";
  urchinTracker();
  //--></script>

这可能是问题所在,还是需要在 XSLT 中更改此代码?

任何帮助将不胜感激。 谢谢

I have been using Urchin 6 but have just started to use Google Analytics also. I am also using Google Search Appliance for site search.

Search is on a subdomain i.e. www.search.mysite.com

The problem is that Google Analytics is tracking site search as a self-referral. After a lot of reading online I have ended up with the GA code configuration below which should be picking up the search subdomain but it isn’t. Can anyone see anything incorrect about my configuration?
- E.g. is the GATC request process order correct

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-xxxxxx-1']);
  _gaq.push(['_setLocalRemoteServerMode']);
  _gaq.push(['_setLocalGifPath', '/__utm.gif']);
  _gaq.push(['_setDomainName', 'mysite.com]);  
  _gaq.push(['_addIgnoredRef', 'mysite.com']);  
  _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);
  })();

</script>

I have a suspicion that the issue could lie with the configuration of GA on Google Search Appliance. When you add GA it just asks for the UA code on the XSLT and you send up with the script below on each search page:

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script><script type="text/javascript">
     <!--
  _uacct = "UA-xxxxxxx-1";
  urchinTracker();
  //--></script>

Could this be the problem or does this code need to change in the XSLT or maybe not?

Any help would be appreciated.
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

失退 2024-10-23 18:27:06

我没有给你一个完整的答案,因为我正在尝试自己解决一些问题。但这也许有助于提出方法。

我使用的是 Search Appliance 6.8.0.G.30 版本。

我可以在所需设备前端的页面布局助手的“全局属性”部分下的 Analytics 帐户字段中插入我的 Google Analytics 帐号。

该 GUI 方法的作用是将帐号插入到该前端的 XSLT 中:

<!-- *** analytics information *** -->
<xsl:variable name="analytics_account">UA-1234567-1</xsl:variable>

处理转换并呈现​​页面时,如果找到该帐户的值,则会在搜索结果页面中生成此 JavaScript:

<script type="text/javascript" src="http://www.google-analytics.com/ga.js"></script><script type="text/javascript">
     var pageTracker = _gat._getTracker("UA-1234567-1");
     pageTracker._trackPageview();
   </script>

作为使用页面布局助手的替代方法,您可以“编辑基础 XSLT 代码”来手动编辑样式表并插入分析帐户。

默认 XSLT 生成的 Google Analytics 代码可能不是您想要的(可能不是基于您的帖子)。例如,上面的代码片段是同步版本。

因此,您可能无论如何都想编辑 XSLT 来修改代码片段。我想使用异步代码片段,因此我更改了 XSLT 中使用的名为“analytics”的模板(指定不自定义):

<!-- **********************************************************************
 Analytics script (do not customize)
     ********************************************************************** -->
<xsl:template name="analytics">
 <xsl:if test="string-length($analytics_account) != 0">
   <script type="text/javascript" src="{$analytics_script_url}"></script>
   <script type="text/javascript">
     var pageTracker = _gat._getTracker("<xsl:value-of select='$analytics_account'/>");
     pageTracker._trackPageview();
   </script>
 </xsl:if>
</xsl:template>

该模板是您之前在 XSLT 中输入的帐户信息(通过 GUI 或 XSLT)被替换。它在前端 XSLT 中的不同位置被调用。

还可以更改分析脚本的 URL(您会看到“分析”模板中使用的变量)。

我所做的就是用我自己的异步版本替换上面的“分析”模板。因此,现在当我查看呈现的搜索结果时,我会看到那里的异步代码片段。

在我的 _setDomainName 方法中,我在域之前有一个前导句点:.mysite.com,这与我们网站其余部分上启用 Google Analytics(分析)的其他页面一致。

这方面的“最佳实践”似乎是一些讨论的领域:http:// /www.roirevolution.com/blog/2011/01/google_analytics_subdomain_tracking.php

该帖子的许多评论都涉及自我推荐。

在设备搜索结果页面上,Google Analytics 代码段紧随 后面显示。标签。

关于在何处定位异步代码段(如果要拆分,则为“部分”)的讨论已在重复的论坛帖子中提出:

http://www.google.com/support/forum/p/Google%20Analytics/thread?tid=71ba44443f0bfbc3&hl=en

http://www.google。 com/support/forum/p/Google%20Analytics/thread?tid=22ac794d8f26a2f4&hl=en

这对我来说是关于异步代码段的一个很好的参考:

异步跟踪使用指南:
http://code.google.com/apis/analytics/docs/tracking /asyncUsageGuide.html

将代码片段移至 需要我对 XSLT 进行一些思考和更彻底的了解(并且可能会进行一些调整,这些调整可能会因未来的设备版本和潜在的 XSLT 更改而受到损害)

在调试分析方面,我已经开始专注于研究特定于 GA 的值cookies 和 __utm.gif 使用 Firebug 和其他类似的浏览器工具。

这篇文章:

http://blog.vkistudios.com/index.cfm/2008/12/17/Slicing-and-Dicing-Cookies--Part-2--Body-Parts

及其后续内容,以及该站点的其他页面确实有助于提出故障排除方法。

I don't have a complete answer for you, as I'm trying to work out some glitches myself. But maybe this will help suggest approaches.

I'm using version 6.8.0.G.30 of the search appliance.

I can insert my Google Analytics account number in the Analytics Account field under the "Global Attributes" section of the Page Layout Helper for the desired Appliance Front End.

That GUI approach has the effect of inserting the account number into the XSLT for that Front End:

<!-- *** analytics information *** -->
<xsl:variable name="analytics_account">UA-1234567-1</xsl:variable>

When the transformation is processed and the page is rendered, if a value is found for the account, then this JavaScript is generated in the search results page:

<script type="text/javascript" src="http://www.google-analytics.com/ga.js"></script><script type="text/javascript">
     var pageTracker = _gat._getTracker("UA-1234567-1");
     pageTracker._trackPageview();
   </script>

As an alternative to using the Page Layout Helper, you can "Edit underlying XSLT code" to manually edit the stylesheet and insert the analytics account.

The Google Analytics code produced by the default XSLT may not be what you want (probably isn't based on your post). For example, the snippet above is the synchronous version.

So, you'll probably want to edit the XSLT anyway to modify the snippet. I wanted to use the asynchronous snippet, so I changed the template named "analytics" used in the XSLT (that specifies to not customize):

<!-- **********************************************************************
 Analytics script (do not customize)
     ********************************************************************** -->
<xsl:template name="analytics">
 <xsl:if test="string-length($analytics_account) != 0">
   <script type="text/javascript" src="{$analytics_script_url}"></script>
   <script type="text/javascript">
     var pageTracker = _gat._getTracker("<xsl:value-of select='$analytics_account'/>");
     pageTracker._trackPageview();
   </script>
 </xsl:if>
</xsl:template>

That template is where the account information you've previously entered in the XSLT (via GUI or XSLT) gets substituted in. It's called at various locations in the Front End XSLT.

It's also possible to change the URL for the analytics script (you see that variable used in the "analytics" template).

What I did was to substitute the "analytics" template above with my own asynchronous version. So now when I look at the rendered search results, I see the async snippet there.

In my _setDomainName method, I have a leading period before the domain: .mysite.com which is consistent with the other Google Analytics-enabled pages on the rest of our site.

The "best practice" for this seems to be an area of some discussion: http://www.roirevolution.com/blog/2011/01/google_analytics_subdomain_tracking.php

Many of the comments on that post refer to self-referrals.

On the appliance search results page, the Google Analytics snippet appears immediately following the <body> tag.

The discussion of where to locate the asynchronous snippet (or "parts" if it's being split) has been raised in repeated forum posts:

http://www.google.com/support/forum/p/Google%20Analytics/thread?tid=71ba44443f0bfbc3&hl=en

http://www.google.com/support/forum/p/Google%20Analytics/thread?tid=22ac794d8f26a2f4&hl=en

This has been a pretty good reference for me on the asynchronous snippet:

Asynchronous Tracking Usage Guide:
http://code.google.com/apis/analytics/docs/tracking/asyncUsageGuide.html

Moving the snippet to <head> would take me some thinking and a more thorough look at the XSLT (and probably tweaking that would be jeopardized with future appliance versions and potential XSLT changes)

In terms of debugging Analytics, I've started to focus on investigating the values of GA-specific cookies and the __utm.gif using Firebug and other similar browser tools.

This post:

http://blog.vkistudios.com/index.cfm/2008/12/17/Slicing-and-Dicing-Cookies--Part-2--Body-Parts

as well as its followup, and other pages at that site have really helped suggest an approach to troubleshooting.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文