💡 The following three articles are a simple guide for non-developers on how to install the Meta Pixel for DPA on your website using Google Tag Manager (GTM). They assume that you already have Google Tag Manager already installed, and that you know why the Meta Pixel is important. For instructions on how to install Google Tag Manager, visit this tutorial.
Installing the Meta Pixel using Google Tag Manager is relatively straightforward, and should take 3–5 minutes.
Part 1: Installing the Meta Pixel to all pages
Go to your Facebook Business Manager and Events manager to grab the code of your Meta Pixel.
- Click Install code manually
- Click Copy Code
You can also use the code below and replace PIXEL-ID
with your Meta Pixel ID (you need to replace it twice).
<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','//connect.facebook.net/en_US/fbevents.js');
fbq('init', 'PIXEL-ID');
fbq('track', 'PageView');
</script>
<noscript>
<img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=PIXEL-ID&ev=PageView&noscript=1" />
</noscript>
Once you have found your Meta Pixel Code
- Open Google Tag Manager
- From the left menu, click Tag > Create a new tag
- Rename the tag from "Untitled Tag" to "Meta Pixel"
- Choose product: Select Custom HTML tag
- Configure Tag: Click on Configure Tag and paste your Meta Pixel code
- Click on Continue
- Fire On: Select all Pages
- Create Tag
Does it work?
To check if it works, you need to first publish the changes. You can either Publish or Preview. Preview is always a safer option: if you made mistakes nobody will be affected and your website will run normally.
This is what the Pixel Helper extension should display on Chrome after you refresh the page. (Pixel ID should be a different number.)
If everything looks good, go back to GTM, Publish the changes and you are done. At this stage, you are already more advanced than 90% of Facebook advertisers.
Next: PART 2 - Installing the DPA modifications
Do you want to run Dynamic Products Ads? You now need to add the required Pixel modifications for Google Tag Manager.