Javascript Omniture跟踪和jQuery

Javascript Omniture跟踪和jQuery,javascript,jquery,html,adobe-analytics,Javascript,Jquery,Html,Adobe Analytics,我已经创建了一些网站,通过jQuery和CSS调用#div容器来提取内容。有人知道在创建这些类型的单页网站时使用Omniture Site Catalyst跟踪代码的方法吗?可能吗 之前,我一直在将Omniture用于更传统的html站点,方法是插入软件提供的难以辨认的代码块。在这种情况下,它似乎跟踪所有的.html页面 <!-- SiteCatalyst Code version: H.17. Copyright 1997-2008 Omniture, Inc. More

我已经创建了一些网站,通过jQuery和CSS调用#div容器来提取内容。有人知道在创建这些类型的单页网站时使用Omniture Site Catalyst跟踪代码的方法吗?可能吗

之前,我一直在将Omniture用于更传统的html站点,方法是插入软件提供的难以辨认的代码块。在这种情况下,它似乎跟踪所有的.html页面

       <!-- SiteCatalyst Code version: H.17.
Copyright 1997-2008 Omniture, Inc. More info available at
http://www.omniture.com -->
<script language="JavaScript" type="text/javascript" src="http://www.urlofsite.com/js/s_code.js"></script>
<script language="JavaScript" type="text/javascript"><!--
/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
var s_code=s.t();if(s_code)document.write(s_code)//--></script>
<script language="JavaScript" type="text/javascript"><!--
if(navigator.appVersion.indexOf('MSIE')>=0)document.write(unescape('%3C')+'\!-'+'-')
//--></script><noscript><a href="http://www.omniture.com" title="Web Analytics"><img
src="http://code.urlofsite.com/b/ss/ranhrollup/1/H.17--NS/0"
height="1" width="1" border="0" alt="" /></a></noscript><!--/DO NOT REMOVE/-->

<!-- End SiteCatalyst code version: H.17. -->
</body>
</html>
您可以将跟踪代码添加到此函数,以指定不同的页面名,并发送额外的页面查看图像请求,如下所示:

$('a.manned-flight').click(function() {
  s.pageName = "www.urlofwebsite.com:Books";
  s.t();
  $('html, body').animate({
    scrollTop: 1250
  }, 1000, function() {
    parallaxScroll(); // Callback is required for iOS
  });
  return false;
});

但考虑到网站有多大,以及我必须定义多少内容区域,这似乎是一种不切实际的方法,而且有点笨重,代码明智。有没有办法用Javascript数组实现这一点?

许多月前,我不得不为Web CMS系统设置Omniture的分析工具,特别是我们公司的产品和购物车组件。代码包含在我们网站模板的每个页面上(即包含文件)。假设您的站点不是完全静态的站点,您也可以这样做,将代码放入.js文件、模板、include文件、母版页、视图中(无论您使用的是站点范围内的重用方法)。如果我没记错的话,Omniture坚持在结束body标签之前有它的代码。一旦代码就位,编写一些javascript为特定变量赋值,用于在Omniture代码中设置适当的值。例如,如果您的页面碰巧创建了一个很好的SEO标题,您可以从标题中提取用于Omniture页面名称的值。这只是一个例子

另一方面,如果您的站点是静态站点,那么您的选择就不那么容易了。如果你能控制你的div是如何生成的,你会过得更好。我的意思是,如果您可以以常规方式将数据返回给div,那么您可以使用javascript或您最喜欢的javascript库(例如jQuery)为您的Omniture变量生成适当的信息。更进一步,如果您能够完全控制HTML的生成方式,那么您可以添加一个特定的类来进行监视,就像您的载人飞行示例一样。然而,我会寻找一些更通用的所有类型的点击

正如我所说的,如果您能够控制呈现的数据,那么从呈现的HTML中提取数据就会更容易。否则,就很难提供Omniture所需的有意义的信息。希望这有帮助

这就是我对你问题的有限理解所想的。假设您的数据采用标准格式,如下面的示例

<div class="product-item">
    <input class='item-title' type='hidden' value='Book Title #1 Specific Page Name'/>
    <input class='other-stuff-for-analytics' type='hidden' value='More stuff here'/>
    <h3>Book Title #1</h3>
    <p>Description of Book Title #1 and some junk...</p>
</div>
<div class="product-item">
    <input class='item-title' type='hidden' value='Book Title #2 Specific Page Name'/>
    <input class='other-stuff-for-analytics' type='hidden' value='More stuff here'/>
    <h3>Book Title #2</h3>
    <p>Description of Book Title #2 and some junk...</p>
</div>
<div class="product-item">
    <input class='item-title' type='hidden' value='Book Title #3 Specific Page Name'/>
    <input class='other-stuff-for-analytics' type='hidden' value='More stuff here'/>
    <h3>Book Title #3</h3>
    <p>Description of Book Title #3 and some junk...</p>
</div>

<!-- The code below could be in your template/include file/master page/view/ .js file -->
<script>
    $('div.product-item').click(function () {
        var analyticsPageName = "";
        /* Possibly pull the value from hidden input  */
        analyticsPageName = $(this).children('input.item-title').val();

        /* OR Pull the information from the block of HTML that has the page title */
        analyticsPageName = $(this).children('h3').text();

        // ---OR---
        //whatever else you need to do to scrape your HTML
        //to get the information to plug into a variable

        s.pageName = analyticsPageName;
        s.t();
        $('html, body').animate({
            scrollTop: 1250
        }, 1000, function () {
            parallaxScroll(); // Callback is required for iOS
        });
        return false;
    });
</script>

书名#1
书名#1和一些垃圾的描述

书名#2 书名#2和一些垃圾的描述

书名#3 书名#3和一些垃圾的描述

$('div.product-item')。单击(函数(){ var分析SPAGENAME=“”; /*可能从隐藏的输入中提取值*/ analyticsPageName=$(this.children('input.item title').val(); /*或者从具有页面标题的HTML块中提取信息*/ analyticsPageName=$(this.children('h3').text(); //---或--- //您还需要做什么来刮除HTML //获取要插入变量的信息 s、 pageName=analyticsPageName; s、 t(); $('html,body')。设置动画({ 滚动顶部:1250 },1000,函数(){ parallaxScroll();//iOS需要回调 }); 返回false; });
我认为Jquery有一个名为
Jquery.address
的插件库,它实现了对基于Jquery的操作的自动跟踪。 如果本机为Google Analytics配置了此库,但在过去我还添加了Omniture SiteCatalyst代码


你可以试试。

你没有和你的Omniture联系人谈过,或者你的工作时间到了吗?他们应该能告诉你。
<div class="product-item">
    <input class='item-title' type='hidden' value='Book Title #1 Specific Page Name'/>
    <input class='other-stuff-for-analytics' type='hidden' value='More stuff here'/>
    <h3>Book Title #1</h3>
    <p>Description of Book Title #1 and some junk...</p>
</div>
<div class="product-item">
    <input class='item-title' type='hidden' value='Book Title #2 Specific Page Name'/>
    <input class='other-stuff-for-analytics' type='hidden' value='More stuff here'/>
    <h3>Book Title #2</h3>
    <p>Description of Book Title #2 and some junk...</p>
</div>
<div class="product-item">
    <input class='item-title' type='hidden' value='Book Title #3 Specific Page Name'/>
    <input class='other-stuff-for-analytics' type='hidden' value='More stuff here'/>
    <h3>Book Title #3</h3>
    <p>Description of Book Title #3 and some junk...</p>
</div>

<!-- The code below could be in your template/include file/master page/view/ .js file -->
<script>
    $('div.product-item').click(function () {
        var analyticsPageName = "";
        /* Possibly pull the value from hidden input  */
        analyticsPageName = $(this).children('input.item-title').val();

        /* OR Pull the information from the block of HTML that has the page title */
        analyticsPageName = $(this).children('h3').text();

        // ---OR---
        //whatever else you need to do to scrape your HTML
        //to get the information to plug into a variable

        s.pageName = analyticsPageName;
        s.t();
        $('html, body').animate({
            scrollTop: 1250
        }, 1000, function () {
            parallaxScroll(); // Callback is required for iOS
        });
        return false;
    });
</script>