如何在reactjs应用中添加Google Adwords转换?

时间:2018-06-05 00:40:18

标签: reactjs google-analytics google-adwords

我需要在反应组件的html文件中调用添加到脚本中的函数。

这是脚本:

<!-- Google Code for XXXXX Conversion Page
In your html page, add the snippet and call
goog_report_conversion when someone clicks on the
chosen link or button. -->
<script type=“text/javascript”>
goog_snippet_vars = function() {
   var w = window;
   w.google_conversion_id = XXXXXXX;
   w.google_conversion_label = “TYw-XXXXXXXX”;
   w.google_remarketing_only = false;
}
goog_report_conversion = function(url) {
  goog_snippet_vars();
   window.google_conversion_format = “3”;
   var opt = new Object();
   opt.onload_callback = function() {
   if (typeof(url) != ‘undefined’) {
     window.location = url;
   }
 }
 var conv_handler = window[‘google_trackConversion’];
 if (typeof(conv_handler) == ‘function’) {
   conv_handler(opt);
 }
}
</script>
<script type=“text/javascript”
 src=“//www.googleadservices.com/pagead/conversion_async.js“>
</script>

如何点击反应组件内的按钮来调用goog_report_conversion函数?

0 个答案:

没有答案