Skip to content

Implement queued listener mode for Facebook pixel events#1

Merged
rtraselbd merged 7 commits intorevoltify:mainfrom
zambodaniel:queued-listener
Apr 4, 2026
Merged

Implement queued listener mode for Facebook pixel events#1
rtraselbd merged 7 commits intorevoltify:mainfrom
zambodaniel:queued-listener

Conversation

@zambodaniel
Copy link
Copy Markdown
Contributor

This pull request introduces a configurable "queued listener mode" for handling Facebook Pixel events, allowing you to choose between synchronous and asynchronous processing of pixel events. The mode is controlled via a new configuration option and is respected throughout the event listener, middleware, and service provider. Comprehensive tests are added to verify both queued and synchronous behaviors.

Configuration and Dependency Injection:

  • Added a new queued_listener_mode option to pixelify.php config, allowing developers to toggle between queued (asynchronous) and synchronous event handling for Facebook Pixel events.
  • Updated the service provider (PixelifyServiceProvider) to inject the appropriate mode ($isQueued) into both the SendPixelEvent listener and FacebookTrackingMiddleware based on the config setting.

Listener and Middleware Updates:

  • Modified SendPixelEvent to implement ShouldQueue and respect the isQueued flag, so it conditionally queues events based on configuration.
  • Updated FacebookTrackingMiddleware to accept the isQueued flag and only handle tracking synchronously when not in queued mode, improving performance and flexibility.

Testing Enhancements:

  • Added extensive feature tests to cover both queued and sync modes, verifying event dispatching, listener queuing behavior, and correct middleware cookie handling in each mode.

Copilot AI review requested due to automatic review settings March 26, 2026 11:29
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Facebook Pixel integration by introducing a configurable 'queued listener mode'. This allows for flexible event processing, enabling asynchronous handling of pixel events via a queue to improve application performance, or maintaining synchronous processing for immediate feedback. The changes span configuration, event listeners, middleware, and service providers, all thoroughly validated with new test cases to ensure robust operation in both modes.

Highlights

  • Configurable Queued Listener Mode: Introduced a new queued_listener_mode option in pixelify.php to allow developers to toggle between asynchronous (queued) and synchronous event handling for Facebook Pixel events.
  • Conditional Event Queuing: The SendPixelEvent listener now implements ShouldQueue and conditionally queues events based on the isQueued flag, enabling asynchronous processing when configured.
  • Middleware Adaptation: The FacebookTrackingMiddleware was updated to accept the isQueued flag, ensuring that tracking is only handled synchronously when not in queued mode, improving performance and flexibility.
  • Dependency Injection Updates: The PixelifyServiceProvider was modified to inject the appropriate isQueued mode into both the SendPixelEvent listener and FacebookTrackingMiddleware based on the configuration setting.
  • Comprehensive Testing: Extensive feature tests were added to cover both queued and synchronous modes, verifying event dispatching, listener queuing behavior, and correct middleware cookie handling in each scenario.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new queued_listener_mode configuration to control whether Facebook Pixel events are processed asynchronously via a queue or synchronously. This involved modifying the FacebookTrackingMiddleware and SendPixelEvent listener to respect this new mode, and updating the PixelifyServiceProvider for dependency injection. The feature tests were also refactored to cover both queued and synchronous modes. However, critical issues were identified regarding configuration key mismatches in both the service provider and the tests, which would prevent the new feature from functioning as intended and the tests from accurately validating it. Additionally, there's an opportunity to improve test maintainability by reducing duplication using Pest's datasets.

Comment thread src/PixelifyServiceProvider.php Outdated
Comment thread tests/Feature/PixelifyTest.php Outdated
Comment thread tests/Feature/PixelifyTest.php Outdated
Comment thread tests/Feature/PixelifyTest.php Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a configurable “queued listener mode” to control whether Facebook Pixel events are processed asynchronously (queued) or synchronously, wiring the setting through the service provider, listener, middleware, and feature tests.

Changes:

  • Introduces a new config option for queued vs sync processing.
  • Updates SendPixelEvent to implement conditional queueing via ShouldQueue + shouldQueue().
  • Updates FacebookTrackingMiddleware to skip tracking cookie handling when queued mode is enabled, and expands tests to cover both modes.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
config/pixelify.php Adds queued_listener_mode config/env toggle for queued vs sync behavior.
src/PixelifyServiceProvider.php Adds contextual DI to inject the queued-mode flag into the listener and middleware.
src/Listeners/SendPixelEvent.php Implements conditional queueing based on injected config flag.
src/Http/Middleware/FacebookTrackingMiddleware.php Conditionally runs tracking-cookie logic only in sync mode.
tests/Feature/PixelifyTest.php Splits tests into queued vs sync mode blocks and adds assertions for listener/middleware behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/PixelifyServiceProvider.php Outdated
Comment thread tests/Feature/PixelifyTest.php Outdated
Comment thread config/pixelify.php Outdated
@zambodaniel zambodaniel marked this pull request as draft March 26, 2026 11:44
@zambodaniel zambodaniel marked this pull request as ready for review March 26, 2026 12:57
@rtraselbd rtraselbd merged commit 16830cf into revoltify:main Apr 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants