توضیحات
Stop losing sales to ad blockers and browser restrictions. Send accurate events to Meta CAPI & Pinterest CAPI and manage all tags with GTM. This plugin creates a direct, reliable server-side bridge between your store and the Meta (Facebook) and Pinterest Conversions APIs (CAPI), while also integrating Google Tag Manager (GTM) for your browser-side tags.
The key advantage is getting all the benefits of server-side tracking—like improved data accuracy and better ad optimization—without the cost and complexity of a separate GTM Server Container. This powerful approach helps you capture more conversions, build stronger lookalike audiences, and achieve a higher ROI on your ad campaigns.
Key Benefits:
- Maximize Your Ad ROI: Feed Meta and Pinterest’s algorithms with accurate, server-side data to improve ad optimization, build higher-quality lookalike audiences, and run more profitable retargeting campaigns.
- Eliminate Extra Cloud Costs: Get the full power of server-side tracking without the complexity and monthly fees of a Google Tag Manager Server Container or other cloud services.
- Prevent Data Loss: By sending data directly from your server, you bypass ad blockers and browser tracking restrictions, capturing conversions that the Pixel might miss.
- Ensure Perfect Data Integrity: Our unified dataLayer guarantees that your server (CAPI) and browser (Pixel) events use the same ID, completely eliminating duplicate conversion data.
Core Features:
- Direct CAPI for Meta & Pinterest: Integrates directly with both Meta (Facebook) and Pinterest’s Conversions API, sending rich e-commerce events from your server.
- Smart GTM Integration: Automatically injects the Google Tag Manager script and creates a comprehensive, standards-compliant dataLayer for all your browser-side tags (Meta Pixel, Pinterest, GA4, etc.).
- Full WooCommerce Event Coverage: Tracks all critical e-commerce events right out of the box.
- Built-in Debug Log: Easily monitor and debug every server-side event with a real-time, filterable log that shows success and failure responses from the APIs.
Please check the installation page for the recommended GTM settings for deduplication.
Our Philosophy
This plugin is completely free and fully functional. There are no hidden “pro” versions or locked features. We believe in providing powerful, accessible tools for the WordPress community. If you find this plugin useful, please consider supporting its continued development with a donation. Thank you!
External Services
This plugin connects your website to external services to send event data.
- Service Used: Meta Conversion API
- Purpose: To send user interaction and e-commerce event data from your server to Meta’s servers for ad performance measurement, optimization, and audience building.
- Data Sent: Event details (product ID, price) and user parameters (IP address, user agent, hashed email/name/phone, Facebook cookies) are sent when a user performs a key action.
- Service Used: Pinterest Conversions API
- Purpose: Same as the Meta CAPI, providing reliable tracking for ad performance and audience building on Pinterest.
- Data Sent: Event details and hashed user parameters are sent upon user action.
- Service Used: Google Tag Manager
- Purpose: To load a JavaScript container from Google’s servers that allows you to manage and deploy marketing and analytics tags.
- Data Sent: The plugin provides your GTM Container ID to Google to fetch the correct script. GTM itself may collect data based on how you configure your tags.
نصب
- Upload the plugin folder to the
/wp-content/plugins/directory and activate it. - Navigate to the Meta CAPI & GTM page from your main WordPress menu.
- Enter your GTM Container ID to inject the GTM script on your site.
- Enter your Meta Pixel ID and API Access Token for the server-side connection. Do the same for Pinterest if applicable.
- Go to the “Event Management” tab to select which CAPI events you want to track.
- Configure your GTM container using the instructions in the “Recommended GTM Setup” section below.
Recommended GTM Setup
Crucial First Steps:
To prevent duplicate events and ensure data accuracy, you must configure two settings in your Meta account and GTM container.
1. Turn Off Meta’s Automatic Event Tracking:
* In your Meta Business Suite, navigate to Events Manager and select your Pixel.
* Go to the Settings tab.
* Scroll to the Event Setup section and turn Off the toggle for Track Events Automatically Without Code. This plugin will handle all event sending.
- Pause Automatically Created GTM Tags:
- In your GTM container, please pause or delete any automatically created tags that start with
FB_. Since we will be creating our own tags manually, only they should be active.
- In your GTM container, please pause or delete any automatically created tags that start with
TEMPLATE SETUP
To save time and prevent errors, we have created a GTM container template. You can import this file to automatically create all the necessary variables, triggers, and tags.
Step 1: Download the Template
Go to the “Meta CAPI & GTM” settings page in your WordPress admin panel. You will see an info box at the top with a link to download the gtm-template.json template file. Download this file to your computer.
Step 2: Import the Template into GTM
- Go to your Google Tag Manager container.
- Navigate to the Admin section.
- Click on Import Container.
- Click Choose container file and select the
gtm-template.jsonfile you downloaded. - Choose a New workspace and give it a descriptive name (e.g., “CAPI Import”).
- IMPORTANT: Choose the Merge import option. Do NOT choose “Overwrite”, as this could delete your existing tags.
- The preview screen will show you all the new tags, triggers, and variables that will be added. Click Confirm.
Step 3: Configure Your IDs
After the import is complete, you must update the placeholder IDs with your own tracking IDs.
- Go to the Tags section.
- Find and click on the “GA4 – Google Tag (Configuration)” tag.
- Replace
GA4_MEASUREMENT_IDwith your actual GA4 Measurement ID (e.g.,G-XXXXXXXXXX). - Save the tag.
- Replace
- Find and click on the “Meta – PageView” tag.
- Replace
META_PIXEL_IDwith your actual Meta Pixel ID. - Save the tag.
- Replace
- Find and click on the “Pinterest – PageView” tag.
- Replace
PINTEREST_TAG_IDwith your actual Pinterest Tag ID. - Save the tag.
- Replace
Step 4: Publish
Once you have updated your IDs, click the Submit button in the top right corner, then Publish your container. Your GTM setup is now complete!
MANUAL SETUP
Step 1: Create GTM Variables
Create the following variables of the type Data Layer Variable.
* Variable Name: DLV - event_id
* Data Layer Variable Name: event_id
* Variable Name: DLV - ecommerce
* Data Layer Variable Name: ecommerce
* Variable Name: DLV - Hashed Email
* Data Layer Variable Name: user_data.email
* Variable Name: DLV - ecommerce.shipping_method
* Data Layer Variable Name: ecommerce.shipping_method
* Variable Name: DLV - ecommerce.payment_method
* Data Layer Variable Name: ecommerce.payment_method
Step 2: Create GTM Triggers
Create the following triggers using the Custom Event type.
* Trigger Name: CE - PageView Meta
* Event name: page_view_meta
* Trigger Name: CE - View Item
* Event name: view_item
* Trigger Name: CE - Add to Cart
* Event name: add_to_cart
* Trigger Name: CE - Begin Checkout
* Event name: begin_checkout
* Trigger Name: CE - Purchase
* Event name: purchase
* Trigger Name: CE - View Item List
* Event name: view_item_list
* Trigger Name: CE - View Cart
* Event name: view_cart
* Trigger Name: CE - Select Item
* Event name: select_item
* Trigger Name: CE - Add Shipping Info
* Event name: add_shipping_info
* Trigger Name: CE - Add Payment Info
* Event name: add_payment_info
Step 3: Create GTM Tags
A) Meta Tags (Facebook Pixel)
Install the “Facebook Pixel” template from the GTM Community Template Gallery. Create the following tags.
* Tag: Meta – PageView
* Event Name: PageView
* More Settings > Event ID: {{DLV - event_id}}
* Trigger: CE - PageView Meta
-
Tag: Meta – ViewContent
- Event Name:
ViewContent - Object Properties:
{{DLV - ecommerce}} - More Settings > Event ID:
{{DLV - event_id}} - Trigger:
CE - View Item
- Event Name:
-
Tag: Meta – AddToCart
- Event Name:
AddToCart - Object Properties:
{{DLV - ecommerce}} - More Settings > Event ID:
{{DLV - event_id}} - Trigger:
CE - Add to Cart
- Event Name:
-
Tag: Meta – InitiateCheckout
- Event Name:
InitiateCheckout - Object Properties:
{{DLV - ecommerce}} - More Settings > Event ID:
{{DLV - event_id}} - Trigger:
CE - Begin Checkout
- Event Name:
-
Tag: Meta – Purchase
- Event Name:
Purchase - Object Properties:
{{DLV - ecommerce}} - More Settings > Event ID:
{{DLV - event_id}} - Trigger:
CE - Purchase
- Event Name:
-
Tag: Meta – ViewCategory
- Event Name:
ViewCategory - Object Properties:
{{DLV - ecommerce}} - More Settings > Event ID:
{{DLV - event_id}} - Trigger:
CE - View Item List
- Event Name:
-
Tag: Meta – AddPaymentInfo
- Event Name:
AddPaymentInfo - Object Properties:
{{DLV - ecommerce}} - More Settings > Event ID:
{{DLV - event_id}} - Trigger:
CE - Add Payment Info
- Event Name:
B) Pinterest Tags
Prerequisite: Install the “Pinterest Tag” template from the GTM Community Template Gallery. You must also create the following Data Layer Variables for e-commerce data:
* DLV - ecommerce.value (Data Layer Variable Name: ecommerce.value)
* DLV - ecommerce.currency (Data Layer Variable Name: ecommerce.currency)
* DLV - ecommerce.items (Data Layer Variable Name: ecommerce.items)
Create the following tags:
-
Tag: Pinterest – PageView
- Tag ID: Your Pinterest Tag ID
- Hashed Email:
{{DLV - Hashed Email}} - Event to Fire:
page_visit - Custom Parameters: Name
event_id, Value{{DLV - event_id}} - Trigger:
CE - PageView Meta
-
Tag: Pinterest – ViewContent
- Tag ID: Your Pinterest Tag ID
- Hashed Email:
{{DLV - Hashed Email}} - Event to Fire:
page_visit - Custom Parameters: Add
event_id,value,currency, andline_itemswith their corresponding variables. - Trigger:
CE - View Item
-
Tag: Pinterest – AddToCart
- Tag ID: Your Pinterest Tag ID
- Hashed Email:
{{DLV - Hashed Email}} - Event to Fire:
add_to_cart - Custom Parameters: Add
event_id,value,currency, andline_itemswith their corresponding variables. - Trigger:
CE - Add to Cart
-
Tag: Pinterest – InitiateCheckout
- Tag ID: Your Pinterest Tag ID
- Hashed Email:
{{DLV - Hashed Email}} - Event to Fire:
initiate_checkout - Custom Parameters: Add
event_id,value,currency, andline_itemswith their corresponding variables. - Trigger:
CE - Begin Checkout
-
Tag: Pinterest – Purchase
- Tag ID: Your Pinterest Tag ID
- Hashed Email:
{{DLV - Hashed Email}} - Event to Fire:
checkout - Custom Parameters: Add
event_id,value,currency, andline_itemswith their corresponding variables. - Trigger:
CE - Purchase
-
Tag: Pinterest – ViewCategory (as Search)
- Tag ID: Your Pinterest Tag ID
- Hashed Email:
{{DLV - Hashed Email}} - Event to Fire:
search - Custom Parameters:
- Name
event_id, Value{{DLV - event_id}} - Name
search_query, Value{{DLV - ecommerce.item_list_name}}
- Name
- Trigger:
CE - View Item List
C) Google Analytics 4 Tags
Prerequisite: Before you begin, make sure you have your Measurement ID (starts with G-) from your Google Analytics 4 property. You must also create the following Data Layer Variables:
* DLV - ecommerce.currency (Data Layer Variable Name: ecommerce.currency)
* DLV - ecommerce.value (Data Layer Variable Name: ecommerce.value)
* DLV - ecommerce.items (Data Layer Variable Name: ecommerce.items)
* DLV - ecommerce.transaction_id (Data Layer Variable Name: ecommerce.transaction_id)
* DLV - ecommerce.item_list_name (Data Layer Variable Name: ecommerce.item_list_name)
First, create the main configuration tag that loads GA4 on all pages.
* Tag: GA4 – Google Tag (Configuration)
* Tag Type: Google Analytics > Google Tag
* Tag ID: Your GA4 Measurement ID (e.g., G-XXXXXXXXXX)
* Important: Uncheck the “Send a page view event when this configuration loads” box. We will send it manually with the next tag.
* Trigger: All Pages
Next, create the event tags that will send data from the dataLayer to Google Analytics.
* Tag: GA4 – Event – PageView
* Tag Type: Google Analytics > GA4 Event
* Configuration Tag: Select your GA4 - Google Tag (Configuration) tag.
* Event Name: page_view
* Trigger: CE - PageView Meta
-
Tag: GA4 – Event – ViewItem
- Tag Type: Google Analytics > GA4 Event
- Configuration Tag: Select your
GA4 - Google Tag (Configuration)tag. - Event Name:
view_item - Event Parameters:
- Parameter Name:
currency, Value:{{DLV - ecommerce.currency}} - Parameter Name:
value, Value:{{DLV - ecommerce.value}} - Parameter Name:
items, Value:{{DLV - ecommerce.items}}
- Parameter Name:
- Trigger:
CE - View Item
-
Tag: GA4 – Event – AddToCart
- Tag Type: Google Analytics > GA4 Event
- Configuration Tag: Select your
GA4 - Google Tag (Configuration)tag. - Event Name:
add_to_cart - Event Parameters:
- Parameter Name:
currency, Value:{{DLV - ecommerce.currency}} - Parameter Name:
value, Value:{{DLV - ecommerce.value}} - Parameter Name:
items, Value:{{DLV - ecommerce.items}}
- Parameter Name:
- Trigger:
CE - Add to Cart
-
Tag: GA4 – Event – BeginCheckout
- Tag Type: Google Analytics > GA4 Event
- Configuration Tag: Select your
GA4 - Google Tag (Configuration)tag. - Event Name:
begin_checkout - Event Parameters:
- Parameter Name:
currency, Value:{{DLV - ecommerce.currency}} - Parameter Name:
value, Value:{{DLV - ecommerce.value}} - Parameter Name:
items, Value:{{DLV - ecommerce.items}}
- Parameter Name:
- Trigger:
CE - Begin Checkout
-
Tag: GA4 – Event – Purchase
- Tag Type: Google Analytics > GA4 Event
- Configuration Tag: Select your
GA4 - Google Tag (Configuration)tag. - Event Name:
purchase - Event Parameters:
- Parameter Name:
transaction_id, Value:{{DLV - ecommerce.transaction_id}} - Parameter Name:
currency, Value:{{DLV - ecommerce.currency}} - Parameter Name:
value, Value:{{DLV - ecommerce.value}} - Parameter Name:
items, Value:{{DLV - ecommerce.items}}
- Parameter Name:
- Trigger:
CE - Purchase
-
Tag: GA4 – Event – ViewItemList
- Tag Type: Google Analytics > GA4 Event
- Configuration Tag: Select your
GA4 - Google Tag (Configuration)tag. - Event Name:
view_item_list - Event Parameters:
- Parameter Name:
item_list_name, Value:{{DLV - ecommerce.item_list_name}} - Parameter Name:
items, Value:{{DLV - ecommerce.items}}
- Parameter Name:
- Trigger:
CE - View Item List
-
Tag: GA4 – Event – ViewCart
- Tag Type: Google Analytics > GA4 Event
- Configuration Tag: Select your
GA4 - Google Tag (Configuration)tag. - Event Name:
view_cart - Event Parameters:
- Parameter Name:
currency, Value:{{DLV - ecommerce.currency}} - Parameter Name:
value, Value:{{DLV - ecommerce.value}} - Parameter Name:
items, Value:{{DLV - ecommerce.items}}
- Parameter Name:
- Trigger:
CE - View Cart
-
Tag: GA4 – Event – SelectItem
- Tag Type: Google Analytics > GA4 Event
- Configuration Tag: Select your
GA4 - Google Tag (Configuration)tag. - Event Name:
select_item - Event Parameters:
- Parameter Name:
items, Value:{{DLV - ecommerce.items}}
- Parameter Name:
- Trigger:
CE - Select Item
-
Tag: GA4 – Event – AddShippingInfo
- Tag Type: Google Analytics > GA4 Event
- Configuration Tag: Select your
GA4 - Google Tag (Configuration)tag. - Event Name:
add_shipping_info - Event Parameters:
- Parameter Name:
currency, Value:{{DLV - ecommerce.currency}} - Parameter Name:
value, Value:{{DLV - ecommerce.value}} - Parameter Name:
shipping_tier, Value:{{DLV - ecommerce.shipping_method}} - Parameter Name:
items, Value:{{DLV - ecommerce.items}}
- Parameter Name:
- Trigger:
CE - Add Shipping Info
-
Tag: GA4 – Event – AddPaymentInfo
- Tag Type: Google Analytics > GA4 Event
- Configuration Tag: Select your
GA4 - Google Tag (Configuration)tag. - Event Name:
add_payment_info - Event Parameters:
- Parameter Name:
currency, Value:{{DLV - ecommerce.currency}} - Parameter Name:
value, Value:{{DLV - ecommerce.value}} - Parameter Name:
payment_type, Value:{{DLV - ecommerce.payment_method}} - Parameter Name:
items, Value:{{DLV - ecommerce.items}}
- Parameter Name:
- Trigger:
CE - Add Payment Info
After creating all tags, submit and publish your GTM container.
سوالات متداول
-
Does this plugin replace the Meta Pixel?
-
It completes it. The plugin sends reliable server-side (CAPI) data, and uses GTM to send browser-side data. Our plugin ensures both events use the same
event_id, allowing Meta to merge them perfectly and avoid duplication. -
What is the difference between this and a GTM Server Container?
-
A GTM Server Container offloads server-side logic to Google’s cloud infrastructure, which can be complex and costly. Our plugin integrates this server-side logic directly into your WordPress site. This means you get the full power of CAPI without needing to set up or pay for a separate cloud server.
-
What plugins are required?
-
WooCommerce is the only requirement. We strongly recommend disabling the e-commerce features of other GTM plugins (like Google Site Kit) to prevent data conflicts.
نقد و بررسیها
توسعه دهندگان و همکاران
“All-in-one CAPI for Meta & Pinterest + GTM” نرم افزار متن باز است. افراد زیر در این افزونه مشارکت کردهاند.
مشارکت کنندگانترجمه “All-in-one CAPI for Meta & Pinterest + GTM” به زبان شما.
علاقه مند به توسعه هستید؟
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
گزارش تغییرات
3.1.0
- Major Feature: Added detailed tracking for checkout funnel steps: ‘Add Shipping Info’ and ‘Add Payment Info’ events for deeper analysis of cart abandonment.
- Major Feature: Added ‘Select Item’ event tracking for analyzing product clicks from category and shop pages.
- Major Feature: Added a new admin setting to choose the Product Identifier for events (SKU with fallback to ID, or ID Only), making the plugin flexible for stores without SKUs.
- Improvement: Significantly enriched Pinterest CAPI user data to improve match rates, mirroring the data sent to Meta.
- Improvement: Corrected Pinterest CAPI event mapping for ‘InitiateCheckout’ to improve funnel accuracy.
3.0.0
- Major Improvement: Enriched the ‘view_item_list’ (Category View) event for GA4, now including the full list of products displayed on the page for advanced analytics. [cite: 70]
- New Feature: Added comprehensive tracking for the ‘remove_from_cart’ event, providing deeper insights into cart abandonment.
- New Feature: Added tracking for the ‘login’ event to the dataLayer for GA4 and CAPI.
- Improvement: Enriched the ‘Purchase’ event dataLayer with coupon codes, payment method, and shipping method details.
- Improvement: Enhanced the Pinterest CAPI ‘add_to_cart’ event to include detailed product line items, improving data quality.
- Security: Hardened the AJAX event handler with recursive sanitization for all incoming data, improving overall security.
2.9.0
- Improvement: View Category and GA4 settings
2.8.0
- Fix: Pinterest external_id and click_id.
2.7.0
- Fix: Duplicate pageview fix.
2.6.0
- Fix: Pinterest line_items fix.
2.5.0
- Fix: AddToCart fix.
2.4.0
- Fix: Pinterest data format fix.
2.3.0
- Major Feature: Full Pinterest Conversions API (CAPI) and Pixel integration.
- Improvement: Added a robust AJAX-based tracking method for the ‘AddToCart’ event to ensure it fires correctly with all themes and caching systems.
- Improvement: Enhanced ‘PageView’ event tracking with a dedicated dataLayer push to ensure perfect deduplication between browser and server events.
- Improvement: Redesigned the admin panel by merging Meta and Pinterest settings into a unified tab.
- Improvement: Enhanced the event log to display the platform (Meta/Pinterest) for each successful event.
- Improvement: Added a manual “Refresh Log” button to the admin panel to bypass caching and view real-time event data.
- Housekeeping: General code refinements and WordPress standards alignment for repository submission.
2.2.0
- Improvement: Developments for improved Event Match Quality.
2.1.0
- Security: Added nonce checks for admin forms to prevent CSRF vulnerabilities.
- Security: Implemented late escaping for all echoed variables in the admin panel to prevent XSS.
- Security: Hardened database queries by ensuring all parts of the query are properly prepared.
- Security: Sanitized all
$_SERVERsuperglobal inputs to prevent potential injection issues. - Documentation: Added a required “External Services” section to the readme.txt to disclose the use of the Meta Conversion API.
- Housekeeping: Bumped version number.
2.0.0
- Major Feature: Added Google Tag Manager (GTM) container script injection. The plugin is now an all-in-one solution.
- Major Feature: Unified Data Layer for both CAPI and GTM to enable flawless event deduplication.
- Improvement: Added a GTM Container ID field to the admin settings.
- Housekeeping: Updated plugin name and description to reflect new GTM capabilities.
1.8.0
- Feature: Added first name, last name, and phone hashing (fn, ln, ph) for improved Event Match Quality.
1.7.0
- Improvement: Enhanced overall security.
1.6.0
- Improvement: Updated admin panel UI/UX for better usability.
1.5.0
- Feature: Added Dataset Quality API report submission on Pixel ID change.
1.4.0
- Feature: Added server-side PageView event tracking.
1.3.0
- Improvement: Optimized performance of event tracking hooks.
1.2.0
- Security: Hardened database queries and improved input sanitization.
- Standardization: Added full translation support and aligned code with WordPress.org best practices.
1.1.0
- Feature: Added dashboard with event statistics.
1.0.0
- Initial public release.