Make the pixel access token optional and skip pixels without one - #41
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41 +/- ##
============================================
- Coverage 67.99% 67.07% -0.92%
- Complexity 134 135 +1
============================================
Files 30 30
Lines 403 413 +10
============================================
+ Hits 274 277 +3
- Misses 129 136 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
loevgaard
force-pushed
the
fix/18-user-agent-regex
branch
from
September 7, 2026 11:37
d55fb32 to
2555afe
Compare
loevgaard
force-pushed
the
fix/21-pixel-access-token
branch
from
September 7, 2026 11:37
f4fa60a to
17cd9c1
Compare
loevgaard
force-pushed
the
fix/18-user-agent-regex
branch
from
September 7, 2026 12:03
2555afe to
2809b78
Compare
loevgaard
force-pushed
the
fix/21-pixel-access-token
branch
from
September 7, 2026 12:03
17cd9c1 to
f7941c5
Compare
The configuration required an access token even for client side only setups, while the provider happily produced pixels without one and the handler posted them anyway, which Meta rejects and Messenger retries. The token is now optional and the send handler skips and logs pixels that have none. Fixes #21
loevgaard
force-pushed
the
fix/18-user-agent-regex
branch
from
September 7, 2026 12:18
2809b78 to
1b06004
Compare
loevgaard
force-pushed
the
fix/21-pixel-access-token
branch
from
September 7, 2026 12:18
f7941c5 to
1d50dd3
Compare
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.
Fixes #21
Problem
Three places disagreed about whether a pixel needs an access token:
Configurationmarkedaccess_tokenasisRequired()->cannotBeEmpty(), so a client-side-only setup had to invent a dummy token, even though the README says the token is for server side and the SDK'sPixel::$accessTokenis nullable for exactly that reason.ConfigurationBasedPixelProvidercarried a comment claiming it filters pixels whose id or access token is empty, while the code only filtered empty ids. An unsetMETA_ACCESS_TOKENtherefore produced a pixel with anulltoken.SendEventHandlerposted for every pixel regardless. With anulltoken the field is dropped from the body, Meta answers 400, the SDK throws, and Messenger retries until the message reaches the failure transport. Synchronously it took the page down instead.Change
access_tokenis optional (defaultNull());idstays required.SendEventHandlerfilters out pixels without an access token, logging one warning per pixel with the pixel id, event name and event id, and returns without calling the client when nothing is left. Client side tracking is untouched, since renderingfbq()only needs the id.Tests
Four unit tests for the handler (sends, skips token-less pixels, sends nothing when none qualify, does not mutate the caller's event) and an extension test asserting
pixels: [{id: '1234'}]is accepted.