dongzecai0684 2012-07-23 06:26
浏览 33
已采纳

Google Analytics跟踪自定义属性

How do I track a custom property for each page on my site? For example, as well as tracking page views, bounce rate, etc for a given page, I want to be able to track a custom property as well (specifically, the number of times someone clicks a specific link on a specific page).

Below is a mockup of what I want to be able to see (either on Google Analytics dashboard or via GAPI):

enter image description here

  • 写回答

1条回答 默认 最新

  • douza19870617 2012-07-23 11:55
    关注

    You can do this with event tracking. See google's guide for more information: https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide

    Example:

    <head>
    ...
    <script>
    var _gaq=[['_setAccount','UA-XXXX-X'],['_setDomainName', 'example.com'],['_trackPageview']];
    ...
    </head>
    <body>
    ...
    <a href="#" onClick="_gaq.push(['_trackEvent', 'Custom Clicks Category', 'Custom Link Clicks Action', 'Custom Label', 1]);">Click me</a>
    ...
    <script>
    (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
    g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
    s.parentNode.insertBefore(g,s)}(document,'script'));
    </script>
    

    The final param, which I didn't use is the non-interaction parameter and it's usage depends on your particular case and how you would like bounce rate effected. Read about it at https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide#non-interaction

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部