If you’re already using Facebook as a marketing tool, you want to measure the results, right? You have multiple options here – remarketing, Facebook conversion tracking, etc. However everything takes time to implement – you send an email to the developer with requirements of what should be tracked and it takes him weeks complete the task. But not anymore! With the help of Google Tag Manager you can drastically speed up the process.



This blog post assumes you have a working knowledge of Google Tag Manager tags. If you’re a beginner – I highly recommend checking out these free Google Tag Manager courses, first. The minimum requirements are:

  • You have Google Tag Manager tracking code installed on your website.
  • You know what tags, triggers, variables and dataLayer are and how they work in Google Tag Manager.

P.S.  This blog post is a part of more comprehensive guide – Google Tag Manager + Facebook, so if you’re looking for in-depth information about how to upgrade your Facebook marketing with Google Tag Manager, give it a try.


Facebook Conversion Tracking Googe Tag Manager

If you’re familiar with Twitter conversion tracking setup process via Google Tag Manager, with Facebook it is pretty similar. All you need to do is:

  1. Register a Facebook Business Manager account, create a Facebook Pixel, copy its code. I have described how to find Pixel code here.
  2. In Google Tag Manager, create Custom HTML tag and paste Facebook Pixel’s code (I have described it in this blog post).
  3. Create additional event tags which send interaction data to Facebook (that’s what I’ll explain in this blog post). That data will be used to create more precise remarketing audiences.

Facebook Conversion Tracking with GTM

To optimize and measure Facebook ad campaigns, you need to track important events on your website and send that data to Facebook.

Those “important events” (in Facebook documentation and interface) are called Standard events. Currently there are 9 supported types of events:

List of Standard Facebook Events

When important event occurs on your website, you have to fire a separate piece of code in addition to your Facebook Pixel tag, so that you can measure when someone submits a form, clicks a button or makes a purchase.

You can later use those events to build audiences with custom combinations, e.g. “Show ads to those people who Added product to their cart in last 30 days. 

Create custom combination Facebook Conversion Tracking

You can even go one step further by mixing several events in one remarketing audience, e.g. show my ads to those who added product to cart and visited certain pages but did not make a purchase.

The sky is the limit.



For every interaction you want to track with Facebook, you’ll need to create a separate GTM Custom HTML tag with few lines of code. For example:

Few things I’d like to mention:

  • Make sure that Facebook Pixel tag (mentioned in chapter No. 2 of this blog post) fires before any Facebook event tag. The best way to do that is to set higher priority to Pixel tag.
  • With Google Tag Manager, I can easily insert any variables which transfer information from your website (depending on context) to Facebook. As you can see in the code example above, with Lead type of event (when visitor subscribes to newsletter) I also transfer form’s position which is dynamically inserted via Data Layer variable {{dlv – formPosition}}.
    Very useful: check out this list of all available data attributes that can be passed along with Standard Facebook Events.
  • Content_name, content_category and other attributes are not required in event code, but they give you better understanding which lead generation forms perform better. If you don’t want to track such specific data, basic event code will do just fine:

To give a better understanding of Facebook Standard events, I’ll give you brief explanation of each one of them.



If you’re tracking visitors on a blog, ViewContent Facebook event should fire when visitor navigates to a blog post page. If you’re the owner of e-commerce business, then your content is a product page. Sample tag could look like this:

Viewed content Facebook Pixel Tag In Google Tag Manager
Trigger’s (that I used for this Custom HTML Facebook tag) settings are:

  • Title – Pageview – Viewed Blog Post.
  • Type – Pageview.
  • This trigger fires on – Some Page Views
  • Rule – Page Path starts with /post/, because all posts in my blog contain “/post/” in URL., e.g. https://www.analyticsmania.com/post/google-tag-manager-facebook/.



When a visitor uses search on my blog, page’s URL changes to analyticsmania.com/?s=search_query. So for Facebook Search Tag I’ll use trigger with the following settings:

  • Title – Pageview – Used Search.
  • Type – Pageview.
  • This trigger fires on – Some Page Views
  • Rule – Page Path starts with /?s=

Keep in mind, additional parameters (i.e. search_string) are optional. This applies to all Facebook events.



If you own an online store, then this event is pretty important in order to measure sales funnel. Every e-commerce platform is really different, so it’s impossible to describe a standard method how to track Added to cart  event.

The most robust solution would be to ask developer to send this interaction as a dataLayer event. Then you could catch that event with Google Tag Manager and use it as a trigger which launches AddToCart Facebook Event.

Read this blog post to find out how you can use Data Layer Events as Triggers.



The issue is pretty similar to Add To Cart events – it’s impossible to write a solution that fits all online stores. The most robust solution is to ask developer to send this interaction as a dataLayer event.



If your checkout process consists of more than one step, then usually step 1 has some unique string in the URL, e.g. sampleshop.com/checkout/step1/some_other_stuff. In that case you can use Pageview Trigger with the following rules (remember – it’s only an example. In your case Page Path might be different):

  • Title – Pageview – Initiated Checkout.
  • Type – Pageview.
  • This trigger fires on – Some Page Views.
  • Rule – Page Pats contains /checkout/step1/



There are two most common scenarios how we can identify that visitor entered payment information:

  • Either he/she visited a particular page with unique URL. Then, you should use Pageview trigger (like I have described InitiateCheckout tag).
  • Or the URL does not change when payment info is entered. In that case – ask developer to send dataLayer event, whenpayment information was successfully saved. Actually, I’d ask to add two events: 1. User started entering payment information. 2. User successfully entered information. This way I could see how many people bounced off my checkout process in this step.

The same principle (Pageview or Data Layer event) can be also applied to the following Facebook Standard events:

  • Purchase.
  • Lead (a.k.a. signup).
  • CompleteRegistration.

It’s important to mention that Purchase Facebook event requires additional data (Currency and Value). Here’s a sample code:

Very useful information:  I highly recommend reading my guide of 5 form tracking methods with Google Tag Manager. It will be especially useful if you’re want to track Lead or CompleteRegistration Facebook events. Chances are you won’t need developer’s input at all when it comes to tracking form submissions.

When you set up all Facebook tags, do not forget to test them:

  • Utilize GTM’s Preview and Debug mode to see if tags fire when they suppose to.
  • Also use Chrome plugin – Facebook Pixel Helper.



Also, Facebook lets you send any event name you want and any number of key/value combinations you want. Basically, they created an ability to push your entire dataLayer to their platform.

Do you want to create a Facebook audience based on user’s pricing plan or amount of the last payment? No problem. Just use trackCustom method. It works the same way as aforementioned methods, expect you can define your own title, parameters and values.

Say, I own a website a SaaS business and my website contains a pricing form. Visitors can enter their number of subscribers (because pricing of my SaaS depends on the size of subscribers list) and then the form calculates the price.

When the price is calculated, the form GTM fires a custom HTML tag with Facebook Custom Event called usedPricingForm with 2 parameters: pricingRange and numberOfContacts. 

If a visitor used my pricing form (calculator), he is probably interested in my SaaS’ services, right? I could then create a FB remarketing audience based on usedPricingForm event and even create different ads based on visitors’ pricing range.

If you wish, you can add 5 or even 10 additional parameters to your custom events. To be honest, I am not aware of the actual limit of custom parameters. Surely, there is one, but I was a bit lazy to test 🙂

Update: one of Analytics Mania’s readers, Benoite, pointed out that by using trackCustom you won’t be able to optimize your Facebook ads. So keep that in mind. More information – here.



  • It may take up to 24 hours for data to appear in Facebook Business Manager dashboard (but usually it’s processed faster).
  • Minimum size of an audience is 20. So you can start remarketing much faster, compared to Google Adwords, where minimum list size is 100 for Google Display Network and 1000 for Google Search.
  • Before you start tagging, prepare a measurement plan – a list of what you really need to track. It will bring more transparency, help you plan ahead and avoid inconsistency problems.
  • Test, test, test before publishing – devil is in the detail. One tiny mistake can lead to huge problems.

I will not go into details how to setup the actual ad campaign in Facebook. So if you’re new to this, go check out Impact’s blog post.

Other useful resource to keep in mind is Facebook Pixel Implementation Guide (by Facebook).



Facebook conversion tracking is pretty similar to Adwords or Twitter conversion tracking in Google Tag Manager. First, you need to decide which website interactions are important to you. Then set those events within GTM as triggers (e.g. “Visited Thank You Page”) and link them to Custom HTML tags which contain codes of Facebook events.

Remember: for every important interaction you need to create a distinct Custom HTML Facebook event tag within Google Tag Manager.

Facebook conversion tracking enables you to measure your ad campaigns and see which ones drive more signups or sales.

Did I miss something in this blog post? If yes, let me know in the comments!

Julius Fedorovicius

Head of Developer Operations at Omnisend. I am highly interested in Google Tag Manager, Google Analytics, Adwords, Email marketing, Email Deliverability, Digital Marketing in general. You can follow me on Twitter or Linkedin.