Repository navigation
feat(facebookpixel): add facebookpixelOpenBridge option - #1419
Merged
Merged
Conversation
Lets the Meta Pixel send its events to a Conversions API Gateway endpoint.
The openbridge setting has to be applied before fbq('init'), which the
existing facebookpixelMore hook (called after init and PageView) cannot do.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an optional
tarteaucitron.user.facebookpixelOpenBridgesetting to thefacebookpixelservice. When it is a string (the gateway URL), the service callsfbq('set', 'openbridge', facebookpixelId, <url>)beforefbq('init'). When it is not set, nothing changes.Why
Meta's Conversions API Gateway (hosted by Meta on AWS, or by partners such as Stape) relays pixel events server-side. The pixel only uses a gateway if
fbq('set', 'openbridge', ...)runs beforefbq('init').facebookpixelMoreruns afterinitandPageView, so it cannot be used for this, and the service'sif (window.fbq) return;prevents definingfbqbeforehand. Without this option, a site has to replace the whole service.Consent behaviour is unchanged: the line only runs inside the service's
js, so it only runs after the visitor acceptsfacebookpixel.How I checked
Local page with tarteaucitron 1.37.0 and Meta's real
fbevents.js(www.facebook.comblocked, network log recorded):signals/plugins/openbridge3.jsrequested?fbq('set','openbridge',…)infacebookpixelMorefacebookpixelOpenBridgesetI could not test an armed gateway end to end, because it needs a pixel connected to a live gateway.
Only
tarteaucitron.services.jsis changed. I lefttarteaucitron.services.min.jsfor the regular minification pass.🤖 Generated with Claude Code