1. Knowledge base
  2. Meta (Facebook / Instagram)

How to install the Facebook pixel on your website

Follow the steps in this guide to insert the Facebook pixel on your website. You can do it manually or through Google Tag Manager.


Option 1: Install the pixel manually

Option 2: Install the pixel through Google Tag Manager

Option 3: Install the pixel on Shopify


Option 1: Install the pixel manually

  1. Copy the script below
    <!-- 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', '{XXXXXXXXXXXXXXX}');
      fbq('track', 'PageView');
    </script>
    <noscript>
      <img height="1" width="1" style="display:none" 
           src="https://www.facebook.com/tr?id={XXXXXXXXXXXXXXX}&ev=PageView&noscript=1"/>
    </noscript>
    <!-- End Facebook Pixel Code -->
  2. Paste the script between the <head> and </head> tag on your website theme.
  3. Replace the two instances of  "XXXXXXXXXXXXXXX" with your actual pixel ID.
  4. Save and publish the changes

Option 2: Install the pixel through Google Tag Manager

  1. Log in to https://tagmanager.google.com
  2. Click Tags
    Create Facebook Pixel Tag in Google Tag Manager - Step 2 (1)
  3. Click "New"
    Create Facebook Pixel Tag in Google Tag Manager - Step 3
  4. Click "Tag Configuration"
    Create Facebook Pixel Tag in Google Tag Manager - Step 4
  5. Click "Discover more tag types in the Community Template Gallery"
    Create Facebook Pixel Tag in Google Tag Manager - Step 11
  6. Search for "Facebook Pixel" and click "Facebook pixel by facebookarchive"
    Google Workflow - Step 2
  7. Click "Add to workspace"
    Create Facebook Pixel Tag in Google Tag Manager - Step 19
  8. Click "Add"
    Create Facebook Pixel Tag in Google Tag Manager - Step 20
  9. Insert your Facebook Pixel ID in the "Facebook Pixel ID(s)" field
    Create Facebook Pixel Tag in Google Tag Manager - Step 23
  10. Click "Triggering"
    Create Facebook Pixel Tag in Google Tag Manager - Step 24
  11. Select "All Pages"
    Create Facebook Pixel Tag in Google Tag Manager - Step 25
  12. Click "Save" and "Save" again
    Create Facebook Pixel Tag in Google Tag Manager - Step 26
    Create Facebook Pixel Tag in Google Tag Manager - Step 27
  13. Remember to make any required adjustments to respect consent, and publish the changes.