开发者

Can I track a person from where they're coming from and where they go afterwards for my website?

开发者 https://www.devze.com 2023-03-30 06:39 出处:网络
I was wondering if you know if Google Analytics can track not just where the visitor was coming from, but also where he/she went afterwards. I have a mailing list setup on my blog and I would like to

I was wondering if you know if Google Analytics can track not just where the visitor was coming from, but also where he/she went afterwards. I have a mailing list setup on my blog and I would like to know if the users from Google went to my subscribe list.

I have outbound code tracking code from Google analytics on my tags, but I'm not sure if it d开发者_如何学运维oes 100% what I want. I just set it up like 12 hours ago so hopefully GA will update quickly.


No. Not reliably. You get the referer from an HTTP header, there is no equivalent in the other direction.


Asynchronous Code

<script type="text/javascript">
  function recordOutboundLink(link, category, action) {
    _gat._getTrackerByName()._trackEvent(category, action);
    setTimeout('document.location = "' + link.href + '"', 100);
  }
</script>

Traditional (ga.js) Code This should be placed after the standard tracking code snippet, to ensure the tracking object is loaded and retrievable.

<script type="text/javascript">
function recordOutboundLink(link, category, action) {
  try {
    var pageTracker=_gat._getTracker("UA-XXXXX-X");
    pageTracker._trackEvent(category, action);
    setTimeout('document.location = "' + link.href + '"', 100)
  }catch(err){}
}
</script>

Next, revise outbound links to call the new function without first following the link. For example, to log every click on a particular link to www.example.com, you would use the _trackEvent() method in the link's tag:

<a href="http://www.example.com" onClick="recordOutboundLink(this, 'Outbound Links', 'example.com');return false;">

Stolen from: How do I manually track clicks on outbound links?

0

精彩评论

暂无评论...
验证码 换一张
取 消