Skip to content

Conversation

iodic
Copy link
Collaborator

@iodic iodic commented Sep 19, 2025

Description

This changeset updates Purchase event tracking so we can fire the Pixel and CAPI events independently while retaining deduplication with the Event ID. Tracking is now separated by using meta data to determine if the Purchase event is tracked by browser or server side (META_PURCHASE_TRACKED_BROWSER and META_PURCHASE_TRACKED_SERVER). Because of possible race conditions with the meta data (conflicts with other plugins and payment gateways) after checking the meta data of the order a transient is also used for additional checks. The transient key is scoped by order ID and event source (browser or server), acting as a short-lived session flag that prevents the same Purchase event from being tracked multiple times across concurrent processes.

We also clean up unused metadata and transients related to tracking Purchase events.

Type of change

  • Fix (non-breaking change which fixes an issue)

Checklist

  • I have commented my code, particularly in hard-to-understand areas, if any.
  • I have confirmed that my changes do not introduce any new PHPCS warnings or errors.
  • I have checked plugin debug logs that my changes do not introduce any new PHP warnings or FATAL errors.
  • I followed general Pull Request best practices. Meta employees to follow this wiki.
  • I have added tests (if necessary) and all the new and existing unit tests pass locally with my changes.
  • I have completed dogfooding and QA testing, or I have conducted thorough due diligence to ensure that it does not break existing functionality.
  • [n/a] I have updated or requested update to plugin documentations (if necessary). Meta employees to follow this wiki.

Changelog entry

Separate Purchase event tracking for Pixel and CAPI

Test Plan

After installing the plugin, connect to MBE and go through the website to make a purchase: the expected outcome is to see 1 Pixel and 1 CAPI Purchase event per order made on the website.

@iodic iodic added the changelog: fix Took care of something that wasn't working. label Sep 19, 2025
@meta-cla meta-cla bot added the CLA Signed label Sep 19, 2025
@iodic iodic requested a review from vahidkay-meta September 19, 2025 08:05
Copy link
Contributor

github-actions bot commented Sep 19, 2025

📦 Latest Plugin Build

Built at: 2025-09-26T09:46:18.126Z
Commit: 629a348
Size: 1.1M

Download: Click here to download the plugin

To download: Click the link above → Scroll to bottom → Download "facebook-for-woocommerce" artifact

@ukilla ukilla force-pushed the feature/separate-purchase-event-tracking branch from 9dd9e3e to 66f1466 Compare September 23, 2025 11:36
@ukilla ukilla force-pushed the feature/separate-purchase-event-tracking branch from 8588663 to ada781c Compare September 23, 2025 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: fix Took care of something that wasn't working. CLA Signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants