Using a Facebook Tracking Pixel in Your Survey

If you're promoting your Alchemer survey via Facebook ads of course you'll want to track the success of this ad. You can do so using the Meta Pixel, previously known as the Facebook Tracking Pixel.

There are two ways to add the pixel to your survey. Use a JavaScript action to fire the pixel on a single page, or add the code to the Custom Head section to fire it on every page. The code you paste is different for each method, so copy it from the matching section below.

Method 1: Add the pixel with a JavaScript action

To do so you'll need to add a JavaScript action to the Thank You page of your survey. We're using the Thank You page as this is what Alchemer uses to determine whether a survey response is complete; you can choose to place the pixel on another page of your survey if you wish.

  1. To add a JavaScript action to your survey, click the Action button at the bottom of any page in your survey.
  2. You will see an Add Actions page. Locate the JavaScript Action via the Custom Code section at the bottom of the list.
  3. Paste the code below into your JavaScript action. A JavaScript action accepts raw JavaScript, so this version of the code has no script tags and no noscript block.
<!-- Facebook Pixel Code -->
!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', '{your-pixel-id-goes-here}');
fbq('track', 'PageView');
<!-- End Facebook Pixel Code -->

Method 2: Add the pixel to Custom Head to run on every page

  1. Open the Style tab of your survey.
  2. Click HTML/CSS Editor in the bottom right of the Style page.
  3. Paste the code below into the Custom Head section.
  4. Save your changes.
<!-- 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', '{your-pixel-id-goes-here}');
  fbq('track', 'PageView');
</script>
<noscript>
  <img height="1" width="1" style="display:none"
       src="https://www.facebook.com/tr?id={your-pixel-id-goes-here}&ev=PageView&noscript=1"/>
</noscript>
<!-- End Facebook Pixel Code -->

Keep the script tags for this method. Custom Head accepts HTML, so the code above keeps its opening and closing script tags. If you remove them, the browser treats the code as text and it appears in your survey header instead of running.

The performance metrics of your Meta Pixel will be available in Events Manager.

For Meta’s own setup instructions and the current base code, see Get Started with the Meta Pixel in Meta’s developer documentation.

Basic Standard Market Research HR Professional Full Access Reporting
Free Individual Team & Enterprise
Feature Included In