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.
- 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.
- 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.
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.json
file 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_ID
with your actual GA4 Measurement ID (e.g., G-XXXXXXXXXX
).
- Save the tag.
- Find and click on the "Meta - PageView" tag.
- Replace
META_PIXEL_ID
with your actual Meta Pixel ID.
- Save the tag.
- Find and click on the "Pinterest - PageView" tag.
- Replace
PINTEREST_TAG_ID
with your actual Pinterest Tag ID.
- Save the tag.
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
- Tag: Meta - AddToCart
- Event Name:
AddToCart
- Object Properties:
{{DLV - ecommerce}}
- More Settings > Event ID:
{{DLV - event_id}}
- Trigger:
CE - Add to Cart
- Tag: Meta - InitiateCheckout
- Event Name:
InitiateCheckout
- Object Properties:
{{DLV - ecommerce}}
- More Settings > Event ID:
{{DLV - event_id}}
- Trigger:
CE - Begin Checkout
- Tag: Meta - Purchase
- Event Name:
Purchase
- Object Properties:
{{DLV - ecommerce}}
- More Settings > Event ID:
{{DLV - event_id}}
- Trigger:
CE - Purchase
- Tag: Meta - ViewCategory
- Event Name:
ViewCategory
- Object Properties:
{{DLV - ecommerce}}
- More Settings > Event ID:
{{DLV - event_id}}
- Trigger:
CE - View Item List
- Tag: Meta - AddPaymentInfo
- Event Name:
AddPaymentInfo
- Object Properties:
{{DLV - ecommerce}}
- More Settings > Event ID:
{{DLV - event_id}}
- Trigger:
CE - Add Payment Info
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
, and line_items
with 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
, and line_items
with 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
, and line_items
with 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
, and line_items
with 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}}
- 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}}
- 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}}
- 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}}
- 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}}
- 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}}
- 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}}
- 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}}
- 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}}
- 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}}
- Trigger:
CE - Add Payment Info
After creating all tags, submit and publish your GTM container.