Customizing the Facebook Event Pixel via Google Tag Manager

We will send the material to you by email:


    Время чтения: 6 мин.

    Every year, the digital world is watching the release of innovations in the advertising offices of large social networks. Trends in this area are set, of course, by Facebook. No matter how the opponents of “Facebook domination” accuse the network team of being set up only to extort funds from advertisers, the guys from Facebook are constantly improving the advertising account. And as a result, everyone who pays for targeted advertising gets ample opportunities to analyze the effectiveness of advertising campaigns.

    Another giant of the digital age, Google, has also joined in to improve the analytics of advertising companies. Google Tag Manager (hereinafter referred to as GTM) is a free tool that was created primarily to manage code snippets for advertising and analytics purposes. Properly configuring GTM for your advertising campaign goals will help take the process of getting the right data to a new level.

    How to combine the features of the Facebook ad cabinet and GTM?

    Let’s start with the basics. If you have a website and you maintain a business account on Facebook, then the goal of the lion’s share of the advertising campaigns that you launch is transitions to the site and users to perform targeted actions.

    To analyze the effectiveness of conversion advertising campaigns, a tool is used – the Facebook Pixel. Pixel allows:

    • track various actions of the audience on the site;
    • collect information about the target audience and set up more accurate guidelines in advertising;
    • optimize advertising campaigns and increase conversions to the site.

    A pixel is a piece of code that needs to be inserted into the website code.

    The task of an advertising campaign (hereinafter referred to as RK) is not always a direct incentive to purchase. Some RKs also solve problems in getting to know the brand, with expert content presented on the site. Accordingly, the list of user actions on the site is not limited to one.

    Therefore, the Pixel consists of 2 parts:

    • Base code. It is installed on all pages of the site.
    • Event codes. Customized for individual business goals.

    Events are actions on the site (viewing content, filling out a form, purchasing, etc.).

    To track events, you need to place a code snippet in your GTM account, which will be used to record user actions.

    Block of work in the Facebook advertising account

    1. Open the Pixels tab in Events Manager.
    2. Click Customize.
    3. Click Set Code Manually.

    Блок работы в рекламном кабинете Facebook 1 Блок работы в рекламном кабинете Facebook 2 Блок работы в рекламном кабинете Facebook 3

    1. Next, in the “Installing the pixel code” section, click on the “Add your own events” section.
      Добавить свои события
    2. We get the List of events that can be tracked via FB. You can read more about what each standard event from the list above means at the link.
      Список событий
    3. Click the switch next to the event you want to track.
      переключатель рядом с событием
    4. Next, we make the selected event from the list active, and get the event pixel code. Example for the Lead event.
      Пример для события Лид
    5. List of recommended events, their description and pixel codes.
    Event nameDescriptionEvent pixel code
    PurchaseTrack purchases or checkout completion (e.g. thank you landing page or confirmation page)<script>

    fbq(‘track’, ‘Purchase’);

    </script>

    LeadTrack when someone is interested in your offer (e.g. submitting a form, signing up for a trial)<script>

    fbq(‘track’, ‘Lead’);

    </script>

    SearchTrack search queries on the site<script>

    fbq(‘track’, ‘Search’);

    </script>

    ViewContentTrack key page views (e.g. product pages, landing pages, articles)<script>

    fbq(‘track’, ‘ViewContent’);

    </script>

    ContactCommunication between the client and your company by phone/SMS, e-mail or otherwise.<script>

    fbq(‘track’, ‘Contact’);

    </script>

    Submit ApplicationTrack the submission of completed registration forms for your products, services or programs<script>

    fbq(‘track’, ‘SubmitApplication’);

    </script>

    Block of work in Google Tag Manager

    1. Go to GTM.
    2. Choose one of the containers you need.Блок работы в Google Tag Manager 1
    3. Log in to your account and select the “Tags” section.
      Блок работы в Google Tag Manager 2
    4. In the “Tags” section, click on the “Create” function.
      Блок работы в Google Tag Manager 3
    5. Automatically goes to the section of the new tag. Give the name of the tag in the English version of the event (see the table above).
      Блок работы в Google Tag Manager 4 Блок работы в Google Tag Manager 5
    6. In the “Tag Type” section, select the type – Custom HTML.
      Блок работы в Google Tag Manager 13
    7. In the HTML area, paste the event pixel code.
      Блок работы в Google Tag Manager 14
    8. Next, go to the “Triggers” section. A trigger in GTM is a condition under which a tag is enabled or disabled. A tag must have at least one trigger to activate.
      Блок работы в Google Tag Manager 15
    9. We recommend that you carefully consider the conditions for each trigger, i.e. what the user must do on your site to trigger the event of interest. Using the example of the MAVR agency website and our block, we will show the conditions for triggers.

    Our recommendations are not universal, but only hints for ideas and analysis of the logic of actions for the user, which is written on your site.

    Conditions for triggers for each of the recommended events for the site https://mavr.ua/

    EventPage on the siteForms to fill out on the site
    LeadAll pages of the site where there is a button “Order a service
    Submit ApplicationSite pages from the “Thank you” section

    This page appears after placing an application for services on the site.

    Service Order Form
    ViewContentAll pages of the site
    ContactSite page from the “Contacts” sectionSubmitting a form from the Contact page
    SearchSearch result pagesБлок работы в Google Tag Manager 19
    1. Conditions for triggers for each of the recommended events for the site https://vlada-rykova.com
    EventPage/pages on the siteForms to fill out, payment forms or search forms
    Purchasehttps://vlada-rykova.com/kopirayting-video/Click on the button to pay for the video course
    LeadTwo pages from the site or https://vlada-rykova.com/uslugi-i-stoimost/,

    or https://vlada-rykova.com/kontakty/

    Submit ApplicationWebsite page “Thanks”
    ViewContentAll pages of the site
    SearchSearch result pages
    1. Using one of the examples, we will analyze what condition for the trigger we have written under the “Seach” event tag for the site https://mavr.ua

    The condition for activating this trigger is when the user lands on the search results page. You type in the search bar, for example, the word “SMM” and get search results.

    Блок работы в Google Tag Manager 19

    We gave the trigger for the “Seach” event a name:

    Триггеру для события «Seach» мы дали название

    Next, you need to specify the trigger type. In this case, we chose the Page Views type.

    Просмотры страницы

    Then you need to register at what action the trigger is activated. In our example, activation occurs when a site page is generated through a url containing the expression “\?s=”.
    страница сайта сформирована через url, содержащий выражение «\?s=»

    1. After the actions – the name of the tag, inserting the event code, assigning a trigger – to save the tag, click the “Save” button.
      для сохранения тега нажмите кнопку «Сохранить».

    The block of work on the integration of the Facebook Event Pixel and GTA has been completed.

    Conclusions. The implementation of a set of tasks for integrating the Facebook Event Pixel and Google Tag Manager will allow you to collect accurate quantitative and qualitative indicators of the effectiveness of targeted advertising.

    • You will learn what actions the audience performs on the site from a specific traffic source – Facebook.
    • You will be able to collect information about your users and use it when setting up individual audiences in targeted advertising.
    • You will be able to set up more precise characteristics of the target audience for the remarketing system.
    5/5 - (1 vote)