PHP表单中的Adwords转换跟踪

时间:2015-05-13 20:27:36

标签: javascript php google-adwords

我有一个带联系表格的html页面。如果有人填写表单,他们会在同一页面上看到“Thanks”消息。该页面的HTML代码是

<form id="contact" method="post" action="demo">

                                    <div class="row-fluid">
                                        <div class="span6">
                                            <input type="text" required placeholder="First Name" name="Firstname" />
                                        </div>
                                        <div class="span6">
                                            <input type="text" required placeholder="Last Name" name="Lastname" />
                                        </div>
                                    </div>
                                    <div class="row-fluid">
                                        <div class="span6">
                                            <input type="email" required placeholder=" * Email" name="Email" />
                                        </div>
                                        <div class="span6">
                                            <input type="text" required placeholder="Country" name="Country" />
                                        </div>
                                    </div>  

                                    <div class="row-fluid">
                                        <div class="span6">
                                            <textarea name="comment" required placeholder="comment" size="100%"></textarea>
                                        </div>

                                    </div>
                                    <div class="row4">
                                        <input type="submit" data-loading-text="Loading..." class="btn button animated bounceIn" value="request information">
                                    </div>      

                                </form> 

,php代码是

if ($Email=="") {
    echo "<div class='alert alert-error'>
            <a class='close' data-dismiss='alert'>×</a>
            <strong>Warning!</strong> Please enter your email.
        </div>

    ";
}   
elseif ($firstName=="" or $lastName=="" or $country=="") {
    echo "<div class='alert alert-error'>
            <a class='close' data-dismiss='alert'>×</a>
            <strong>Warning!</strong> Please fill all the fields.
        </div>";
}   
else{
    mail($to, $subject, $msg, "From: $_REQUEST[Email]");
    echo "<div class='alert alert-success'>
            <a class='close' data-dismiss='alert'>×</a>
            <strong>Thank you for your message!</strong>

        </div>

    ";  
}

现在,我想将Google Adwords转换代码与联系表单集成。有人可以帮我这个吗?这是我的转换代码:

<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 955016975;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "_3SsCJzniVwQj86xxwM";
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/955016975/?label=_3SsCJzniVwQj86xxwM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

0 个答案:

没有答案