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

# Ad networks

> Configure ad networks and accounts in PNLight to normalize attribution, sync Facebook campaigns, set redirect defaults, and manage delivery settings for paid traffic.

Ad networks organize paid acquisition data in PNLight. Use them to group campaigns by network and account, normalize attribution names, and configure delivery settings that paid traffic depends on.

## How ad networks are structured

PNLight uses three levels for paid acquisition setup:

* **Network**: a provider such as Facebook or a custom traffic source.
* **Account**: a connected Facebook ad account or a custom account inside that network.
* **Campaign**: a synced or manual campaign that appears under the selected network or account.

Use this structure to keep attribution, postbacks, and reporting aligned across the dashboard.

## Before you start

For a Facebook connection, prepare access in Meta before you add the account in PNLight.

* You need admin access to the Meta business portfolio that owns the ad account.
* You need access to the ad account that runs the campaigns.
* You need a Meta dataset or pixel if you want PNLight to send events through Meta Conversions API.
* You need an app link or landing URL for click redirects.

<Info>
  PNLight uses the Marketing API token to sync campaigns and spend. PNLight uses the pixel token only when you enable Conversions API event delivery.
</Info>

## Connect a Facebook account

<Steps>
  <Step title="Open Networks">
    Select a project and open **Networks**.
  </Step>

  <Step title="Connect Facebook">
    Click **Connect Facebook**.
  </Step>

  <Step title="Enter Marketing API settings">
    Add **Facebook Ad Account ID** and **Facebook Access Token (Marketing API)**.
  </Step>

  <Step title="Enter Conversions API settings">
    Add **Facebook Pixel ID (Conversions API)** and **Facebook Pixel Access Token (Conversions API)** if you want PNLight to send events to Meta.
  </Step>

  <Step title="Set the default redirect URL">
    Add **Redirect URL (default)**. PNLight sends users to this URL after it records the ad click.
  </Step>

  <Step title="Create the account">
    Save the account. PNLight validates the credentials and makes the account available for campaign sync.
  </Step>
</Steps>

### Get the Facebook credentials

You need a Facebook ad account ID and a Marketing API access token to connect a Facebook account. Add the pixel ID and pixel access token only when you want PNLight to send mapped events to Meta Conversions API.

#### Get the ad account ID

<Steps>
  <Step title="Open Meta Ads Manager">
    Open the ad account that runs the campaigns you want to sync.
  </Step>

  <Step title="Copy the account ID">
    Copy the numeric ad account ID from the account selector or account settings.
  </Step>

  <Step title="Keep the ID format">
    You can paste the ID as `act_123456789` or `123456789`.
  </Step>
</Steps>

#### Get the Marketing API access token

Create a system user token for PNLight. Do not use a short-lived Graph API Explorer token.

<Steps>
  <Step title="Open the business portfolio">
    Open **Meta Business Settings** and select the business portfolio that owns the ad account.
  </Step>

  <Step title="Create a system user for PNLight">
    Open **Users** > **System users** and click **Add**. Name the user `PNLight` or another clear service name.
  </Step>

  <Step title="Give the system user ad account access">
    Select the system user, click **Add assets**, choose **Ad accounts**, and select the ad account you will add to PNLight. Grant access that allows PNLight to read campaigns, ad sets, ads, and insights.
  </Step>

  <Step title="Choose the Meta app">
    Click **Generate new token** and select the Meta app that belongs to the same business portfolio. If you do not have an app yet, create one in Meta for Developers and connect it to this business portfolio.
  </Step>

  <Step title="Select Marketing API permissions">
    Select `ads_management`. Select `ads_read` too if Meta shows it for your app.
  </Step>

  <Step title="Copy the token">
    Generate the token and copy it immediately. Paste it into **Facebook Access Token (Marketing API)** in PNLight.
  </Step>
</Steps>

Meta reference: [Marketing API authorization](https://developers.facebook.com/docs/marketing-api/overview/authorization/).

#### Get the pixel ID and pixel access token

Use these values only when you want PNLight to send mapped events to Meta Conversions API.

<Steps>
  <Step title="Open Events Manager">
    Open the dataset or pixel that should receive PNLight events.
  </Step>

  <Step title="Copy the pixel ID">
    Copy the pixel or dataset ID from the data source details.
  </Step>

  <Step title="Generate the access token">
    Open the Conversions API settings for the data source and generate an access token.
  </Step>

  <Step title="Copy the token">
    Paste the pixel ID into **Facebook Pixel ID (Conversions API)** and the token into **Facebook Pixel Access Token (Conversions API)** in PNLight.
  </Step>
</Steps>

Meta reference: [Conversions API get started](https://developers.facebook.com/docs/marketing-api/conversions-api/get-started/).

## Add a custom network or account

Use a custom setup when the traffic source is not connected through Facebook sync.

<Steps>
  <Step title="Create the network">
    In **Networks**, click **Add network** and enter the network name and key.
  </Step>

  <Step title="Add aliases">
    Add attribution aliases such as provider-specific names or normalized labels that PNLight should treat as the same network.
  </Step>

  <Step title="Add an account">
    Open the network row and click **Add account**.
  </Step>

  <Step title="Enter account details">
    Add **Account name**, optional **External account ID**, and **Default redirect URL**.
  </Step>
</Steps>

## Configure network settings

Open a network from the table when you need to manage shared delivery settings.

Use the network page to:

* Rename the network.
* Update attribution network aliases.
* Define default system event postbacks.
* Define default app event postbacks.
* Map PNLight events to Facebook standard events when you use Facebook Conversions API.

## Configure account settings

Open an account when you need account-specific click and delivery settings.

Use the account page to:

* Set or change the default redirect URL.
* Copy **URL for your Ad** for Facebook campaign destinations.
* Update Facebook access tokens.
* Update Facebook pixel credentials.
* Turn **Send events to Facebook Conversions API** on or off.

## After setup

* Open [Campaigns](/dashboard/campaigns) and sync or review the campaigns for that account.
* Use ad network and ad campaign filters across **Analytics**, **Customers**, and **Events**.
* Keep attribution aliases current when your provider sends a new network label.
* Turn on Conversions API only after the pixel credentials and event mapping are ready.

<Note>
  Use **Campaigns** after you connect an account to review enabled campaigns, costs, postbacks, and campaign metrics.
</Note>
