How to Pass Parameters to Facebook Pixel Events via Google Tag Manager

to pass parameters to FB pixel events via GTM, Google Tag Manager, Facebook pixel events, parameters

Parameters are specific data points for an event. They allow us to build an audience, to track conversions, and to optimize ad impressions. If you work with eCommerce, it’s necessary to have skills of working with parameters to maximize the benefits of the purchases data. Either to create a technical task or to set up it manually, it can’t be done without understanding the principles of setting parameters.

Many advertisers face the necessity of passing extra data to the system for conversions on the site. It is needed for tracking performance and retargeting. Planning and strategy involve the profitability of advertising costs, the search of a paying audience, the realignment of the budget, and the ad optimization.

When it comes to manual settings, we need to know how this data can be transmitted to Ads Manager or analytics services.

Where can you find parameters in Ads Manager?

If you install Facebook Pixel manually, you have an opportunity to check a code of events and add parameters to them from Facebook’s suggestions.

Pass Parameters to Facebook Pixel Events via Google Tag Manager

You can find the full list of all parameters which are available for standard events on Facebook for developers.

Each of the nine events has all the required and possible parameters. If you want to create dynamic ads, you need to sort out such parameters as content_ids and content_type to specify the ID and product categories.

‘Purchase’ event requires the value and currency parameters.

Recently, we have mentioned this feature in the article about onboarding offline data to the Facebook Ad system. When you transfer data about offline purchases to Facebook, you have to create columns for the value of the price and currency in the data table.

Pass Parameters to Facebook Pixel Events via Google Tag Manager

The Purchase event has a value of $0 by default. Keep in mind that a Purchase event should always have some value. Otherwise, the performance of your ads might be affected. Adding a currency parameter is also a good practice to follow.

In the case of eCommerce, we imply a variety of products with different price tags.

It’s not worth establishing a statistical value for each item. Therefore, we are eager to show you how to set a dynamic value for the value parameter via Google Tag Manager.

How to set up passing parameters via GTM

Before the start, make sure that the basic work is done:

  • standard Facebook Pixel code is installed.
  • container GTM is installed.

So, let’s get the ball rolling.

The minimum we need to send events to the system is the following construction.

Pass Parameters to Facebook Pixel Events via Google Tag Manager

  • fbq indicates interaction with facebook;
  • track — the fact of sending the event;
  • AddToCart is the name of particular event.

We can already send this event to the system, but it still does not have parameters. We can set the parameter in braces, specifying its name and value.

Value, currency, content_ids, and content_type are the names of the variables. Everything that comes after the colon is the value of these variables. As an example of the working code, it can be written like this:

We create this event in the console, then send it to the system by pressing Enter, and after that, check the name and value that we entered in Pixel Helper.

Since this is the example, the Facebook Helper extension throws an error message that the current id does not match the feed, but in the actual configuration, there will not be such an error.

Now, this design needs to be transferred to GTM.

Creating an event with a parameter in GTM

  • Create a new tag.
  • Choose the type Custom HTML.
  • Enter the event code with the parameter in the <script> </ script> container.

Now, you need to select a trigger for the tag.

As a trigger, you can set the page view, click a button, view the video, or more complex actions related to page scrolling.

To send the event after the addition of the goods to the cart, click Click All Element as a trigger.

In addition, you have to define the css selector of the ‘Add to Cart’ button and add it to the rules of our trigger. See below on how to determine the css selector:

Save the trigger, save the tag and update the container. You have added the event with the parameter.

There’s still the matter of how to use the dynamic variables that comply with our products instead of the static parameters that we set.

Creating a dynamic parameter for an event

We take the next page of the goods in the online store as an example.

It shows the product code, name, and price. All these values can be transferred to the system for each new product through dynamic parameters, but not manually.

First of all, you need to create a special variable that would contain the value of the price of the item.

  • In the Variables section, create a new variable.

Choose the type DOM Element.

Furthermore, you need to take a code snippet directly on the site for creating a variable.

The next step is taking the value of the price of the goods. To do that, you need to select this value, then click Inspect / Check item. Thus, you are able to see where the price is placed in the code.

In our case, this is the <span id = “priceblock_pospromoprice”> </ span> element.

Then right-click on this item and select Copy -> Copy selector. We insert this value as Selector to create a variable in GTM.

This is how copied Selector looks like:

Selector indicates the location of the price in the product page code. You have to insert it into the ‘Element Selector’ field in the GTM variable creation window, tentatively selecting the Selection Method ‘CSS Selector’.

Call this variable as ‘price’ and save it. Do not forget to update the container.

Now, let’s check out how it works.

To do this, you have to update the page of the site and see which events work in Google Tag Manager.

You need an event DOM Ready. Open its variables and find dynamic price variable ‘price‘. As you can see, the value is correct.

You can use this variable for dynamic substitution on each page with the goods.

With this in mind, let’s return to the previously created tag and instead of the static value, enter the name of the variable. In addition, you have to do the same thing for content_ids.

As a result, you get the following construction:

Save the tag. Update the container.

Now, let’s check how the updated tag works. Update the page of the site.

You can see that your tag works in Google Tag Manager.

You may test the event in Pixel Helper. As you see, the system receives a custom price parameter with a dynamic value of the goods cost.

Similarly, you are able to create dynamic variables for ID values and product names.

We sorted out how to transfer parameters to Facebook Pixel events via Google Tag Manager. A practicing web analyst Andrew Osipov helped us with that. Andrew is a certified Google trainer, The Andrew Osipov’s web analytics school founder and the author of the blog “Web analytics and results.”

Creating custom conversions and custom audiences

You started to pass values to parameters. Now, you need to create custom conversions in order to measure unique activities and optimize ads for the events that matter most to your business. Moreover, custom conversions help work with retargeting in a segmented way.

Custom conversions can be set up quickly and easily. Follow the instructions below:

Create a custom conversion from an event:

  1. Go to the Custom Conversions page in Ads Manager that is found in Measure & Report column.
  2. Click Create Custom Conversion.
  3. Click URL Contains and select Event.
  4. Select an event (standard or custom), then choose a parameter. You can add multiple parameters by clicking and.
  5. Select a category for your custom conversion.
  6. Give your custom conversion a name, then set a conversion value.
  7. Click Create.

Why do you need to add parameters to events? Let’s imagine you sell a wide range of products and you have a goal to increase the average check from 40 to 50 US dollars in the near future. How can event parameters help optimize ads in such a way as to attract an audience that is willing to pay? It’s pretty simple. If you pass data using the “value” parameter, you always can create a custom conversion for tracking and optimizing ad impressions for those who spend equal to or more than $50. Clearly, it looks like this:

The maximum number of custom conversions per ad account is 100, but you can delete the ones you don’t want to use anymore and create new ones.

Custom audiences

To create a Custom Audience you need:

1. To find “Audiences” in Assets column in Ads Manager.

2. Click Create Audience and select Custom Audience.

3. Click Website Traffic.

4. You see audience settings based on traffic from the site.

 

  • All website visitors. This option lets you create URL rules to include people based on whether they visited specific websites or web pages in the period from 1 to 180 days.
  • People who visited specific webpages. This option allows you to create URL rules to include people based on whether they visited specific websites or web pages. For example, if you specify that the URL should contain “phones”, you will only capture people who visited web pages with the word “phones” in the URL.
  • Visitors by time spend. This option allows you to gather an audience of people who spent more time on the site than other visitors on the average.
  • Events. They give the opportunity to create an audience of people based on events and parameters.

As you already understood, the 4th option is what you need. When you select the necessary event, you can select the parameter you need and enter its value. There is absolutely identical process to create custom conversions. For clarity, we provide the screenshot below:

Where can you use this knowledge?

Here are just a few aspects of using parameters for events:

  • retargeting,
  • ROAS evaluation,
  • Ads optimization
  • and much more.

After setting the parameter to collect data for the purchase price, you will be able to register a conversion “Purchase for more than $50”.

This provides additional opportunities for retargeting for the current paying audience. In addition, it can create look-alike based on that audiences and optimize your advertising campaigns for those who are more likely to make a purchase over $50.

Data collected using the value parameter is also displayed in the Facebook Analytics reports. You can verify the correctness of reports on Revenue or Lifetime Value of the customer with the help of manual settings.

To sum up

Many of us already understand how Facebook Pixel and Google Tag Manager help work, but few people sort out working with parameters completely. We often use parameters with events when working with clients. It allows us not only to effectively achieve results, but also to personalize the communication strategy. The more details we have, the more accurately we will get into the insights of our target audience.The parameters are responsible for all details of the data.

Use the parameters in your work, ask your questions and do not forget to subscribe to our Telegram channel and Messenger chat bot not to miss our next materials!

Мы свяжемся с вами
в течение 10 минут