Skip to main content

I have my base Facebook pixel installed as a domain level script via GTM.


When I click on a “sign up” button, I get a button click auto detect (expected) and a 2nd page view (not expected) when the lightbox is displayed.


If I close the lightbox and then open it again, I get yet another page view.


Anyone know if this is something to do with having my FB base pixel in GTM, with having it in the domain script manager or something else?


FB Pixel Helper - on intial page load:


Then after clicking on the button that brings up the lightbox:


And then again after dismissing and re-opening lightbox:

For the person who goes looking for this same problem, I will answer it myself since no one else seemed to know.


When you open a lightbox with a form in it, you are actually serving up a new page. …lightbox.html

Unbounce magic keeps that from showing on the URL line but it is there if you inspect.


So - when you use GTM to insert your Facebook code and tell it to insert your base pixel (which contains a “page view” event in it) onto every page - it does just that.


To prevent a second page view, you must create a GTM trigger that watches for the URL to contain “lightbox.html”


and use that as an exception trigger in your main Pixel (that has Page View in it.)


Then to fire a different event when the Lightbox opens, create a new tag with your FB standard (or custom) event in it and use that same trigger from above.


Here is my Facebook Pixel Helper list of events up to the point where I am ready to submit the form. You will notice that I have a third event “InitiateCheckout” scheduled to fire on this lightbox page when the form is submitted (using window.ub.hooks.afterFormSubmit.push). Because the base pixel is already loaded on the lightbox page - I can just call the fbq('track', 'InitiateCheckout'); code within the script I have running after Form Submit. (Because the post-submission redirect takes some time, I change the color and label on the form submit button to show the submitter that something happened, so I bundled the FB tag with that action.)



Reply