我想实现一个adwords“转化像素”脚本-这是脚本:
<!-- Google Code for General_Lead Conversion Page --> <script type="text/javascript"> /* <![CDATA[ */ var google_conversion_id = 000; var google_conversion_language = "en"; var google_conversion_format = "3"; var google_conversion_color = "ffffff"; var google_conversion_label = "hahaha"; var google_remarketing_only = false; /* ]]> */ </script> <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js"> </script> <noscript> <div style="display:inline;"> <img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/975247275153/?label=IiuoCNO17lcQgZ2P0QM&guid=ON&script=0"/> </div> </noscript>
到我网站上的联系表格,该表格不会显示“谢谢”页面。这是我提交的表单代码。(验证不是100%完成的:P)
// Send button for the "contact form". $('#sendBtn').click(function(){ //get info var fullname = $("#fullname").val(); var email = $("#email").val(); var text = $("#text").val(); //send info to php $.ajax({ beforeSend: function() { if ( IsEmail(email) == false) { $('#aboutUnsuccess').show("slow"); $('#contactform').hide("slow"); } }, url: 'http://www.example.com/contact.php', type: "POST", data: ({ "fullname": fullname, "email": email, "text": text }), success: function (results){ if ( IsEmail(email) == true) { //hide table $('#contactform').hide('slow', function() { $('#contactform').hide( "slow" ); }); //show textboxes $('#aboutSuccess').show("slow"); } } }); });
我尝试使用.append,但在Google搜索后发现它不起作用。
Google支持异步转换:
https://developers.google.com/adwords-remarketing- tag/asynchronous/
将此脚本加载到您的html文件中:
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion_async.js" charset="utf-8"></script>
然后google_trackConversion在用户单击按钮时调用该函数:
google_trackConversion
window.google_trackConversion({ google_conversion_id: 1234, google_remarketing_only: true, // ... });