开发者

Custom Tracking with Google Analytics

开发者 https://www.devze.com 2022-12-22 02:17 出处:网络
I am trying to figure out how to use my google analytics account, and do custom tracking on certain links and such, but following the technical information on the help site on google isn\'t getting me

I am trying to figure out how to use my google analytics account, and do custom tracking on certain links and such, but following the technical information on the help site on google isn't getting me anywhere. Has anyone done something like this? Point me in the right direction.

UPDATE This is the code, I am not seeing the results in my analytics account yet, but I am not getting errors now.

In header:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXXXXX']); //Commented Out for posting
  _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';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
  })();

</script>

THen on the href of my link I put this:

oncli开发者_JAVA百科ck="_gaq.push(['_trackEvent', 'Link Sponsored', 'Clicked Sponsored']);"

Is this the Correct Way to do it via asyc ga code?


I can't find the problem from your code.

A couple of things:

  1. have you enabled "Event Tracking"? This must be set in your "Profile"

  2. While watching HTTP header activity using, for instance, the Firefox add-on "Live HTTP Headers", look for requests to the _utm.gif. To do this:

    • open the LiveHTTP Headers Panel;

    • then select the "Config" tab;

    • then check "Filter URLs with regexp;

    • type _utm.gif in the text box next to the box you just chekecked; and

    • select the "Generator" tab to record the activity.

0

精彩评论

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