Adding Facebook or Google Analytics tracking scripts to the signup form

Some stores want to be able to track events in the popup signup form. For example, they want to track when a customer clicks the submit button in the sign up form and record the event in Google Analytics or Facebook.
You can have a tracking script included in the signup form by sending the script to  [email protected]. Include the name of the store and request the script is added to the signup form.
The script you supply will be loaded into the `<head>` element of the signup form.
The code you supply will need to include loading the tracking script as well as recording the event. Because the signup form is rendered inside an iframe it cannot rely on the tracking script being loaded in the main page. The tracking  script must be loaded into the iframe as well. 
Here’s an example of a Facebook tracking script that might be supplied:
<!-- 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');
// Insert Your Facebook Pixel ID below. 
fbq('init', 'FB_PIXEL_ID');
fbq('track', 'PageView');
</script>
<!-- Insert Your Facebook Pixel ID below. --> 
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=FB_PIXEL_ID&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
	
This this includes loading the Facebook tracking library (this is the section before fbq(... and then recording the event (everything from fbq(... onwards. ( FB_PIXEL_ID would be replaced by our own Facebook pixel id).
Here’s the same script again that includes tracking the submit button being clicked:
<!-- 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');
// Insert Your Facebook Pixel ID below. 
fbq('init', 'FB_PIXEL_ID');
fbq('track', 'PageView');
document.addEventListener('click', function(e) { 
  if (e.target.nodeName == 'BUTTON') {
    fbq('track', 'NotifyMeSubmit');
  }
})
</script>
<!-- Insert Your Facebook Pixel ID below. --> 
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=FB_PIXEL_ID&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
	

Still need help? Contact Us Contact Us