1

I want to put the fb pixel on the page and then use the conversion pixel to track everyone who is actually filling out the form

<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','https://connect.facebook.net/en_US/fbevents.js');

fbq('init', '');
fbq('track', "PageView");
fbq('track', 'Lead');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=1740955919461347&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->

I have been using this html form:

<form id="contactform" action method="post">
    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 form">
        <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
            <input name="name" type="text" id="name" placeholder="Enter Your Name" >
        </div>
        <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
            <input name="email" type="text" id="email" placeholder="Enter Your Email">
        </div>
        <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
            <input name="phone" type="text" id="phone" placeholder="Enter Your Phone">
        </div>
        <div class="col-lg-3 col-md-3 col-sm-12 col-xs-12">
            <input class="btn-blue" type="button" value="submit" id="submit" onclick="fbq('track', 'Lead')">
        </div>
    </div>
</form>

It takes all the viewer pixelize by facebook.I just need to track who complete the registration form. Thanks in advance.

Jaromanda X
  • 53,868
  • 5
  • 73
  • 87
Jahid Hasan
  • 224
  • 1
  • 15

1 Answers1

0

Integrate the pixel on the registration complete view/page.

Your form does an HTTP POST request to handle and save things server side. After your server has finished, there would be an redirect to this side I think. Otherwise we need to see more of the javascript or backend (php?) code ...

  • Then you have check the return value of the mail function, it's an bool which means it should be true if your mail is sent. [link](http://php.net/manual/de/function.mail.php) – Marcel Müller Sep 05 '16 at 06:48
  • The mail sent if i use valid mail address. Now i need to track those who sent the mail – Jahid Hasan Sep 05 '16 at 07:00
  • Alright, do you build the form within a framework or from scratch? I ask this because if you use a framework, you have to return a new view with the base tracking inside, otherwise it would be the simplest way to send the form via ajax and put the response with something like jquery in your code again. If the ajax is complete, you can then call the tracking. – Marcel Müller Sep 05 '16 at 07:06
  • I have just used the php mail function and no framework with it – Jahid Hasan Sep 05 '16 at 07:08
  • I am a novice in javascript – Jahid Hasan Sep 05 '16 at 07:09
  • Look at the high rated answer here: [link](http://stackoverflow.com/questions/1960240/jquery-ajax-submit-form) – Marcel Müller Sep 05 '16 at 07:09