Duplicate your Google Analytics Events to Facebook Pixel

Dmytro Bulakh
2 min readFeb 26, 2018

--

There was a thought in my head right after I finished testing a dozen of Facebook Events in my GTM. Everything was fine except a length of GTM tags list. There were two tags for most triggers, one for Google Analytics and one for Facebook Pixel. So I started looking for some workaround to make things easier and faster to set up. The first solution that came to my mind was Google Analytics Tasks. This interface allows to hook many stages of Google Analytics tracking process and also there is a custom task that you can use as a trigger for a provided javascript function. So the idea was to prepare a function that would send fbq('track', 'pageView') with every analytics hit and fqb('track', 'event category _ event action') with any event hit. And you can even put your Facebook pixel initialization code there. Then all you need then is:
1. Prepare a Custom JavaScript Variable that will initiate Facebook Pixel and hook into GA processing:

GTM custom JavaScript Variable

2. Set a customTask field with your Google Analytics settings to run this with every GA hit.

GTM Google Analytics Settings variable

Of course this is not a replacement for some custom Facebook pixel tracking but could save quite a lot of time … and space on GTM pages.
Here is some the very basic pageview + event function to be used as a customTask:

--

--

Dmytro Bulakh

Marketing professional, Google Analytics and Google AdWords certified specialist at ppchead.com, beer lover and football aficionado