---
title: "Facebook Pixel"
slug: "facebook-pixel"
updated: 2025-03-19T10:13:49Z
published: 2025-03-19T10:13:49Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://help.nexudus.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Facebook Pixel

## 

## 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](https://www.facebook.com/business/help/952192354843755?id=1205376682832142).

          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](https://www.facebook.com/events_manager2/list/pixel/).

![FacebookPixel_IDFinder.png](https://cdn.document360.io/4f9a66c7-3dbb-4052-97d8-5439302e1512/Images/Documentation/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](https://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](https://cdn.document360.io/4f9a66c7-3dbb-4052-97d8-5439302e1512/Images/Documentation/FacebookPixel_PixelIDEdit.png)

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', 'YOUR_FACEBOOK_PIXEL_ACCOUNT');;
        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. Replace **YOUR_FACEBOOK_PIXEL_ACCOUNT** in the snippet with your **Pixel ID**, making sure you don't remove the simple quotation marks.
2. 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](https://www.facebook.com/business/help/2040882565969969?id=1205376682832142).
