Google Analytics事件跟踪设置

时间:2014-05-29 17:12:01

标签: javascript html google-analytics

有人可以帮我为以下HTML代码编写正确的GA设置吗? 我试图跟踪媒体工具包的下载和功能(两者都是PDF) 我正在运行analytics.js,不幸的是,这对我很不利。

这是代码。

<div class="row">
    <div class="twelve columns">
        <div class="tabs-content-container">
            <div class="eight columns">
                <img src="img/brochure.jpg" alt="blog" style="padding-bottom: 10px;">
            </div>
            <div class="four columns">
                <h3>Download Company Overview</h3>
                <p>Thank you for taking the time to learn more about our company. The additional information in these brochures will tell you more about our history, products and references.</p>
                <p>Our printable company overview brochure is now available for download. Both documents require <a target="_blank" href="http://get.adobe.com/reader/"> Adobe Reader</a>. Click the links below to download our company’s Capabilities and Media Kit.</p>
                <a target="_blank" href="Capabilities.pdf">Download Capabilities &nbsp;&#8594;</a>
            </div>
        </div>
    </div>
</div>
</section>
<!-- end section-tabs -->

<section class="msg-container diff-msg" style="margin-bottom:0;">
    <div class="msg-inner-container">
        <a target="_blank" href="MediaKit.pdf" class="download">Download Media Kit</a> 
    </div>
</section>

问题是我已经习惯了事件跟踪的ga.js风格,我会做这样的事情:<a href="MediaKit.pdf" onclick="_gaq.push(['_trackEvent', 'download', 'one-sheeter', 'about harbordev',, false]);" class="download">Download Media Kit</a>。然而,这不适用于analytics.js,文档对我来说没有意义。

谢谢

1 个答案:

答案 0 :(得分:0)

我明白了。

onClick="ga('send', {'hitType': 'event', 'eventCategory': 'download', 'eventAction': clickedDownload', eventLabel': 'Capabilities' });"
感谢所有试图提供帮助的人。