Google Analytics(分析)和Colorbox - 跨网域跟踪 [英] Google Analytics and Colorbox - Cross domain tracking

查看:157
本文介绍了Google Analytics(分析)和Colorbox - 跨网域跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用我们的GA代码,我们正在跟踪多个域和子域,我们有主要的代码跟踪,只有几个自我推荐。最大的问题是我们使用 Colorbox 进行模态窗口,我需要能够附加代码

With our GA code, we are tracking multiple domains and subdomains, and we have the main bulk of the code tracking properly with only a couple of self-referrals. The biggest issue revolves around the fact that we use Colorbox for modal windows, and I need to be able to attach code to these pages to eliminate self referrals.

我已经做了大量的搜索,并在JavaScript中找到一个解决方案,没有运气。

I've done a lot of searching, and working around in JavaScript to find a work-around, with no luck.

如果我添加 onClick =_ gaq.push(['_ link',$(this).attr('href')]); return false ;到a标签打开模态窗口,当页面刷新与来自谷歌的附加查询字符串参数,它打破模态窗口,并接管整个浏览器窗口。我已经尝试构建一个自定义函数,而不是只是一个直接点击,我得到相同的结果。我发现的唯一参考是本文从2010年开始

If I add onClick="_gaq.push(['_link', $(this).attr('href')]);return false;" to the a tag to open the modal window, when the page refreshes with the attach querystring params from Google, it breaks out of the modal window and takes over the entire browser window. I've tried building a custom function rather than just a straight onclick, and I get the same result. The only reference I have found is this article from 2010.

我在这里失落了。我想可能我可以抓住utmcc信息pre-link并附加到URL提前,没有找到一个方法来抓住从会话。

I'm at a loss here. I was thinking maybe I could grab the utmcc info pre-link and append it to the URL ahead of time, with no luck on finding a way to grab that from the session.

推荐答案

这是我最后使用的代码,感谢yahelc的帮助。

This is the code I ended up using, thanks to yahelc for the help.

$('.link-btn').bind("cbox_complete", function(){
    var pageTracker = _gat._getTrackerByName();
    var href = $.colorbox.element().attr('href');
    if (href) {
        _gaq.push(function() {
          var pageTracker = _gat._getTrackerByName();
            setTimeout(function(){
                $('#cboxLoadedContent iframe').attr('src',pageTracker._getLinkerUrl(href));
            },1000);
        });
    }
});    

这篇关于Google Analytics(分析)和Colorbox - 跨网域跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆