2014-03-06 21 views
0

在這裏我的問題:我放置代碼來跟蹤事件的分析,但事件不發送到分析...所以我不能trak他們。通用分析 - 轉換沒有發送到分析

這裏的代碼(我使用Universal Analytics)

<script> 
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); 

    ga('create', 'UA-46738558-1', 'restaurant-mon-repos.fr'); 
    ga('send', 'pageview'); 

</script> 

現在插在我的網頁代碼。

請注意,我跟蹤不同按鈕上的不同事件,以適應頁面上的不同操作。

$op .= '<ul class="cro_directionscal"> 
        <li class="dir-label">' . __('To:','localize') . '</li> 
        <li><strong>' . stripslashes($postaddr) .  '</strong></li> 
        <li class="dir-label">' . __('From:','localize') . '</li> 
        <li><input id="from-input" type=text value=""/></li> 
        <li><input id="to-input" type=hidden value="' . stripslashes($postaddr) .  '"/></li> 
        <li><input id="driveclick" class="" onclick="Demo.getDirections();ga("send","event","Bouton","Clic","itineraire");" type=button value="' . __('Calculate:','localize') . '"/></li> 
       </ul> 
       <p>' . __('The driving directions are interactive. Click on any bold text for further explanation of the route.', 'localize') . '</p> 
       <div id="dir-container"></div>'; 

代碼的第二部分用於其他跟蹤:

$op .= '<input type="submit" onClick="ga("send","event","bouton","clic","contact");" name="cro_form_sub" id="cro_form_sub" val="" . __("Submit","localize") . "">'; 

我不知道,如果是短線的概率...

謝謝你的幫助球員:)

回答

0

對於OnClick中的兩個函數的代碼的第一部分,我剛剛削減了谷歌分析的一部分,然後我已經直接在Demo.getDirections()函數內插入它,它的工作原理。

對於第二部分,我用(:)函數替換了ga()函數中的(「):(\')逃脫了簡單的引號。它也起作用!:)

相關問題