Back to Community

Understanding and Fixing Event Deduplication Issues with PixelYourSite

Content

If you're using the 'PixelYourSite – Your smart PIXEL (TAG) & API Manager' plugin, you might have encountered a common yet confusing problem: events from your browser and server not being deduplicated correctly in Facebook's Event Manager. This can lead to inflated event counts and inaccurate campaign data. Let's break down why this happens and the most effective ways to resolve it.

What is Event Deduplication and Why Does It Matter?

Deduplication is a crucial process where Facebook pairs a browser-side event with its corresponding server-side (CAPI) event using a unique Event ID. When working correctly, Facebook processes these as a single event, preventing double-counting and ensuring your analytics are accurate. When it fails, you see duplicate entries, skewing your data.

Why Isn't Deduplication Working?

Based on common community reports, here are the primary culprits:

  • Caching Conflicts: This is the most frequent cause. Caching plugins (like LiteSpeed, WP Rocket, NitroPack, or FlyingPress) can cache the Event ID generated by PixelYourSite. If the same Event ID is served to multiple users, Facebook cannot use it for proper deduplication, as each event pair requires a unique ID.
  • Plugin Conflicts: Page builders like Thrive Architect or Elementor can sometimes cause the plugin's configuration object (pysOptions) to output multiple times on a single page, each with a different Event ID, creating confusion.
  • Testing Anomalies: Some users report that during initial testing with a fresh browser (cookies cleared), deduplication might not occur on the very first page load but works correctly on subsequent refreshes. This can be part of Facebook's system initialization.
  • Mixed Pixel Implementations: Running PixelYourSite alongside a manually installed Facebook pixel code will always result in duplicates, as the manual code does not generate the Event IDs necessary for the plugin's CAPI events to deduplicate against.

How to Troubleshoot and Fix Deduplication Problems

1. Verify the Event ID is Unique
The first step is to check if the Event ID is changing. Open your website in an incognito or private browser window. Right-click, select "View Page Source," and search for eventID. Refresh the page several times. The long string of numbers and letters after eventID should be different every time. If it stays the same, your caching is too aggressive.

2. Configure Your Caching Plugin
You must exclude PixelYourSite's scripts from being cached. The specific settings vary by plugin, but generally, you need to add exclusions for scripts containing these strings:

  • pys.js
  • pys.min.js
  • pysEvent.js
  • pysOptions (this JavaScript variable)
  • fbevents.js (Facebook's script)
Consult your caching plugin's documentation for their "JS Exclude" or "Never Cache" settings.

3. Use the Plugin's Built-in Admin-Ajax Option
PixelYourSite includes a setting specifically designed to bypass caching. Enabling the admin-ajax option forces the plugin to send CAPI events through WordPress's admin-ajax.php endpoint, which is typically not cached. You can find this setting on the plugin's main settings page. Be aware that this can increase server load, so monitor performance.

4. Check for Conflicts with Page Builders
If you use a page builder and see duplicate pysOptions variables in your page source, try disabling the builder's specific asset optimization or script handling features to see if the issue resolves. A conflict may require reaching out to the page builder's support for assistance.

5. Ensure a Single Pixel Source
For deduplication to work, you must let PixelYourSite manage the entire pixel implementation. Remove any manually inserted Facebook pixel code from your theme or other plugins. Using both will guarantee duplicate events.

6. Test Properly
Use Facebook's Test Events tool. Perform tests across multiple page loads, not just the first visit. Remember that it can take 24-48 hours for data to fully populate in Facebook's Event Manager for analysis.

When All Else Fails

If you've tried all the steps above and deduplication still fails, the issue could be related to a very specific server configuration or a temporary bug with Facebook's systems. Consistently unique Event IDs are the foundation of the process; if they are unique and deduplication still isn't happening, the matching logic is handled solely by Facebook.

By methodically working through these common issues, you can usually identify and resolve the obstacle preventing proper event deduplication, leading to cleaner, more reliable data for your advertising campaigns.

Related Support Threads Support