Facebook Custom Audience Pixel implementation using GTM Data Layer?

In one of the earlier posts, I have written on implementing Facebook Custom Audience Pixel’s Standard events using Google Tag Manager. It was about writing JavaScript inside Custom HTML Tag. The values of the parameters too were picked up using JavaScript.

Facebook Custom Audience Pixel Standard Events implementation using GTM Data Layer

In this post let us use GTM’s in built Data Layer capability and see an example on how to implement the Standard Events.

Implement the Base Pixel as shown in an earlier post on how to upgrade Facebook Custom Audience Pixel using Google Tag Manager.

Give proper directions to your Developer in implementing the Data Layer related to each standard event. See the example below.

ViewContent Event

Ask your web developer to push needed values into the Data layer as shown in the below code.

 

Create Data Layer variables on GTM for each of the above data point as shown in the below image

facebook custom audience pixel productName_datalayer

Now that you have the above data layer variables created on GTM console, they are ready to be used in the code.

Create a Custom HTML tag for the ViewContent Event

Add the below code in the code section.

Assign a lower number in Tag Firing Priority than the Base pixel.

The most important thing is the trigger which fires this tag. Observe the dataLayer push we have asked our developer to code. There is an event we are passing into it and we named it as fbqViewContent.

We will use this in the triggers section. Add a trigger to the tag which is as shown below.

facebook viewcontent trigger

That’s all. You are all set. You need to follow similar procedure for other kind of events too. Comment below if you face any issues in the above process.

Ram Manohar

Author: Ram Manohar

Independent Digital Analytics and Tag Management Consultant. Web Analytics Expert with 8+ years of experience. Well versed in Digital Analytics, Web Programming, WordPress and Digital marketing. Contact me for consulting!