How to set up custom events for Facebook Ads + Growth Hack via Google Tag Manager

In one of our latest posts, we explain the step-by-step process to install the Facebook pixel on your site via Google Tag Manager.

In this post, I want to take a step further to show you how to set up Facebook Ads custom events and a simple growth hack to improve your remarketing campaigns. 

Set up your events on Facebook Business Manager

Facebook interfaces and tools change quite often. You will see many different ways to install custom events, or your interface won’t look like shown in tutorials. 

So I will show you how to install an event by writing a simple script and pasting it on Google Tag Manager. I think it will help you.

You can also check this video that explains as well how to set it up: 

How to Setup Facebook Pixel | Zero to One Facebook Ad Series #2

This is how a Facebook Ads custom event looks like: 

<script>

    fbq(‘track’, ‘Purchase’, {currency: “USD”, value: 30.00});

  </script>

Every script comes between the tags <script> to open and   </script> to close. 

Inside, we add the parameters to set up such events. 

They will always start with “fbp”. That’s a constant in all events. A programmer will call this an object. 

Now, we need to add a function, or the task this object will perform, and we have two options

  • ‘track’
  • ‘trackCustom’

As you may guess, ‘track’ is used for standard events; ‘trackCustom’ is for custom events. 

The difference between custom and standard events is that Facebook already offers a list of likely events all websites have, such as:

  • Add to Cart: when a user adds a product in a cart on an e-commerce site
  • Checkout: a user is starting the purchase 
  • Add_payment_info: a user is adding payment and credit card details
  • Purchase: a user has successfully finished a purchase
  • Lead: a user landed on a thank you page, which represents he or she have submitted a lead form

And some more. 

Yet, some companies would like to define different types of events, like a software when people start a free trial or have finished a quiz. 

  • We already understand that all our scripts will go between <script> and </script>
  • fbq  is the object or the constant value that we will use first to declare any Facebook event
  • We will call a function or a task, which can be ‘track’ or ‘trackCustom’, depending on the type of event you want to set. 

Now, you will see some values within brackets. These values are the parameters that describe the event. 

As an example, if you have a purchase event some parameters may be the value of such purchase and the currency. But you can also include other options like the quantity or the brand. A parameter is any field and value that describes an event. 

If we check again our initial script, we will see that it’s for setting up a custom purchase event whose value is US30. 

<script>

    fbq(‘track’, ‘Purchase’, {currency: “USD”, value: 30.00});

  </script>

You don’t need to add parameters. So the event could go like this: 

<script>

    fbq(‘track’, ‘Purchase’);

  </script>

And if you wanted to add a custom event—i.e. A kind of event with a different name that Facebook doesn’t offer by default— just add it in the field after track, like this: 

<script>

    fbq(‘trackCustom’, ‘about’);

  </script>

In this case, I wanted to call the custom event “about”; I may use it for users who land on my about page. Also notice that the function is not ‘track’ but ‘trackCustom’ as we’re using a custom event. 

Trigger your custom event on Google Tag Manager

Once you know how your custom event script looks like, it’s time to set it up on Google Tag Manager. 

To install it, follow these steps:

  • Go to tags
  • Add a new tag
  • Choose Custom HTML as tag type
  • Paste your event script

In this case I’m pasting a standard purchase event script: 

You’re almost done, but we need to tell Google Tag Manager when our event should be triggered. 

We only want to fire this event once a user has reached a specific page or has clicked a specific button. 

In this case, We will fire this event on a specific thank you page. 

Let’s add a new trigger. 

The most common one is “All pages” which, as its name says, triggers the script on all pages; if you choose this one, no matter which page a user visits, it will always tag a purchase. That’s not what we want. 

Choose Page View as trigger type:

Now follow these instructions: 

  • Choose Some Page Views
  • Choose Page URL as criteria
  • Contains as condition
  • Thanks as parameter

This trigger will only fire when a user lands on a page whose URL contains “thanks”.

Now you can save and  submit your new version of Google Tag Manager. 

Growth hack: qualifying your remarketing audiences with Google Tag Manager

Now that you know how to set up triggers on Google Tag Manager, what about this idea?

Not all traffic that lands on your site are qualified or have an actual buying intent. 

Most users will bounce, which means that they will land on your site and will exit with no further actions. 

The problem is that remarketing, by default, will target ALL our website visitors, included both qualified and unqualified traffic.

How can we refine our remarketing audience so we can make sure we show ads only to people with higher chances to convert? 

We may set up a new trigger based on their behavior. 

There are some behaviors that represent intent: 

  • spending more than one minute navigating a website
  • Visiting product and pricing pages
  • Or simply scrolling through the 50% of a page

We will do that. We will fire a custom event when any user scrolls more than the 50% of a page. 

Here’s how it works. 

Just use any event that you may want to trigger to log these users. 

The only customization we need is on the trigger. 

So, let’s create a new trigger:

Choose Page scroll as trigger type: 

And setup your criteria. For example, we will create a custom event for all website visitors that scroll more than 50% of a page, thus assuming engagement. 

Now send and submit your changes. 

You may create a remarketing audience of all users who “engaged” with your content and even create a more refined similar audience from it. 

Since you’re here

We want to help you thrive in all your digital marketing efforts. We’ve got dozens of articles, resources, videos, and free tools to help you automate most of your routinary tasks. 

Take a look at our latest posts! 

Udit Goenka
Udit Goenka
Articles: 97