2017-04-18 8 views
0

Googleの目標の変換がpdfをダウンロードすると機能しません。 ga.js.のようGoogleをダウンロードするとGoogleの目標の変換が機能しない

<html> 
<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','https://www.google-analytics.com/analytics.js','ga'); 

    ga('create', 'UA-XXXXXX', 'auto'); 
    ga('send', 'pageview'); 

</script> 

<a href="/wp-content/uploads/2017/03/SEO-ebook-Final.pdf" onClick="javascript:_gaq.push(['_trackPageview','/wp-content/uploads/2017/03/SEO-ebook-Final.pdf']);">Ok<a/ class='bold-uppercase'> 

</html> 

答えて

1

gaq.pushたちの古典のGoogle Analyticsのコード:ここに 私は、次の手順に従っGoogleアナリティクススニペットでは、ユニバーサルアナリティクスであるanalytics.jsを使用していることがわかります。

だから、基本的にあなたは混同しないでください。

<script> 
/** 
* Function that tracks a click on an outbound link in Analytics. 
* This function takes a valid URL string as an argument, and uses that URL string 
* as the event label. Setting the transport method to 'beacon' lets the hit be sent 
* using 'navigator.sendBeacon' in browser that support it. 
*/ 
var trackOutboundLink = function(url) { 
    ga('send', 'event', 'outbound', 'click', url, { 
    'transport': 'beacon', 
    'hitCallback': function(){document.location = url;} 
    }); 
} 
</script> 
You'll also need to add (or modify) the onclick attribute to your links. Use this example as a model for your own links: 

<a href="http://www.example.com" onclick="trackOutboundLink('http://www.example.com'); return false;">Check out example.com</a> 

コードがTrack outbound links

からリッピング
関連する問題