Dotsy Blog

Discover the latest insights and updates

How to Get Facebook Pixel ID and Generate Access Token

Follow this guide to get your Facebook Pixel ID and generate an access token for Conversions API. This setup lets you send server-side events to Facebook for better tracking and ad optimization.

Note: You need admin access to your Facebook Business Manager to get your Pixel ID and generate an access token. Conversions API works with your Pixel to optimize ads by sending events directly from your server to Facebook.

Step 1: Log in to Events Manager

First, log in to Facebook Events Manager (business.facebook.com/events_manager). You must have admin access to Facebook Business Manager to generate access tokens and get your Pixel ID.

https://business.facebook.com/events_manager
Step 2: Choose Your Pixel

Select the Pixel you want to set up Conversions API for. If you don’t have one yet, create it in Events Manager.

Step 3: Go to Settings

After selecting your Pixel, go to the 'Settings' tab. This is where you'll find Conversions API options and your Pixel ID.

Step 4: Generate Access Token

In the 'Conversions API' section, click 'Generate Access Token'. Facebook will create a unique token for server-side event tracking.

Step 5: Copy Your Access Token

Copy the generated access token immediately and store it securely. Facebook won't save it for you. This token allows your server to send events directly to Facebook.

Step 6: Copy Your Pixel ID

While you're in the Settings tab, copy your Pixel ID. You’ll need this ID and the access token when you configure the Conversions API in your store or app.

Best Practices

  • Keep your access token and Pixel ID secure — never expose them in client-side code.
  • Use system user tokens for server-to-server integrations where possible.
  • Rotate tokens periodically and monitor for expiration.
  • Implement robust error handling for API calls using your token.
  • Grant only necessary permissions for security and compliance.

Common Issues

Token Expired: If you see a "Session has expired" error, generate a new access token in Events Manager.
Wrong Pixel ID: Double-check that you’re using the correct Pixel ID in your integration.
Insufficient Permissions: Make sure your token has the required permissions (ads_management, business_management).
App Review Required: Some advanced permissions may need Facebook’s approval. Submit your app for review if needed.