Facebook Pixel
  • 02 Sep 2022
  • 1 Minute to read

Facebook Pixel


Article Summary

What Is Facebook Pixel?

Facebook Pixel is a piece of code that you add to your Members Portal's template to help you measure the effectiveness of your ad campaigns by tracking the actions people take on the portal.

Facebook Pixel can help you make sure your ads are shown to the right customers, drive more sales, or even accurately measure the results of your ads.

Connecting Facebook Pixel to Your Members Portal

Connecting your Members Portal to your Facebook Pixel is a simple two-step process.

Step 1. Creating a Facebook Pixel For Your Members Portal

You first need to create your Facebook Pixel. You can find full instructions on Facebook's Business Help Center.

Facebook Pixel will provide their own code snippet, but we recommend you use the one we provide in the next step.

You also need to copy and save your Pixel ID before moving to the next step. You can find your Pixel ID under it's name or by clicking on the Settings tab in your Events Manager.

FacebookPixel_IDFinder.png

Step 2. Adding Your Pixel ID & Code Snippet to the head.js and app.js Files

Now that you have your Pixel set up and its ID handy, you need to add a code snippet to your head.js and app.js files on the Admin Panel.

  1. Log in to dashboard.nexudus.com if you aren't already.

  2. Click Settings > Web template editor.

  3. Click Built-in files > head.js.

  4. Copy the following code snippet and paste it at the end of the head.js file.

[
 {
 "type": "script",
 "name": "fb-pixel",
 "content": "!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_FACEBOOK_PIXEL_ACCOUNT');fbq('track', 'PageView');"
 }
]
  1. Replace YOUR_FACEBOOK_PIXEL_ACCOUNT with your Pixel ID, making sure you don't remove the simple quotation marks.

FacebookPixel_PixelIDEdit

  1. Click the Save button. 

You now also need to add a code snippet to your app.js template file.

  1. Click on app.js.

  2. Scroll down to the bottom of the page and paste add the following code snippet.

function routeChangeStartHandler(url) {
    if(!window.pixelAdded){
        !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', '177461420223136');;
        fbq('track', 'PageView')
        window.pixelAdded = true;
    }
    else {
        fbq('track', 'PageView')
    }
}

var componentDidMount = function(componentName) {
    if(!window.handlerSet){
        next.router.events.on('routeChangeComplete', routeChangeStartHandler)
        window.handlerSet = true;
    }
    routeChangeStartHandler(next.router.route);
}
  1. Click the Save button. 

All set! You've connected your Facebook Pixel to your Members Portal.

You can test your connection by following the instructions available on the Facebook Business Help Center.


Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.