Requirements
Credit card
Facebook Pixel (Business Manager)
Google Tag Manager
Website backend access
Google Analytics 4 (GA4)
Platform:
Wordpress
Shopify
Laravel or any php sites
Lesson:
Create GTM Web Container
Create GTM Server Container
Create Server via Google Cloud Platform
Create PageView Event in GTM Web Container
Send PageView event to Facebook Pixel with GTM Server Container
Create ViewContent Event in GTM Web Container
Send ViewContent event to Facebook Pixel with GTM Server Container
Create AddToCart Event in GTM Web Container
Send AddToCart event to Facebook Pixel with GTM Server Container
Create Purchase Event in GTM Web Container
Send PageView event to Purchase Pixel with GTM Server Container
Testing the Installation
Step-01: Create GTM Web Container
Tag Name: GA4 - All Pages
Tag type: GA4 Configuration
Triggering: All Pages
Fields to Set: transport_url (Which is come from server-side container)
Step-02: Create GTM Server-side container
Tag Name: GA4 Server-Side Tag
Tag type: Google Analytics: GA4
Triggering
Step-03: Setup Facebook Conversion API in Server Container (Using Facebook Conversion API Tag template) & Test page view event
Put the below from Facebook Event Manager (Business Manager)
Facebook Pixel ID
API Access Token
Test Event Code
Action Source: Website
Triggering
Step-04: Create Lookup Table variable If you only want it triggered for events that you want to send to Facebook Pixel.
Web Container:
Send ViewContent Event to Facebook Pixel with GA4
Create Data Layer variable for GA4 view_item event
Data Layer Variables (Name - Data Layer Variable Name) :
dlv - GA4 - ecommerce Item ID : ecommerce.items.0.item_id
dlv - GA4 - ecommerce Item value : ecommerce.items.0.price
dlv - GA4 - ecommerce Items : ecommerce.items
Event Parameters:
x-fb-cd-content_type - product
currency - BDT
value - {{dlv - GA4 - ecommerce Item value}}
x-fb-cd-content_ids - {{dlv - GA4 - ecommerce Item ID}}
items - {{dlv - GA4 - ecommerce Items}}
Trigger:
Tag:
Send Add to Cart Event to Facebook Pixel with GA4
Data Layer Variables (Name - Data Layer Variable Name) :
dlv - GA4 - ecommerce Item ID : ecommerce.items.0.item_id
dlv - GA4 - ecommerce Item value : ecommerce.items.0.price
dlv - GA4 - ecommerce Items : ecommerce.items
Event Parameters:
x-fb-cd-content_type - product
currency - BDT
value - {{dlv - GA4 - ecommerce Item value}}
x-fb-cd-content_ids - {{dlv - GA4 - ecommerce Item ID}}
items - {{dlv - GA4 - ecommerce Items}}
Trigger:
Tag:
Send Purchase Event to Facebook Pixel with GA4
Data Layer Variables (Name - Data Layer Variable Name) :
dlv - GA4 - ecommerce Items : ecommerce.items
dlv - GA4 - ecommerce transaction ID : ecommerce.transaction_id
dlv - GA4 - ecommerce affiliation: ecommerce.affiliation
dlv - GA4 - purchase value: ecommerce.value
dlv - GA4 - ecommerce tax: ecommerce.tax
dlv - GA4 - ecommerce shipping: ecommerce.shipping
dlv - GA4 - ecommerce coupon: ecommerce.coupon
dlv - GA4 - ecommerce currency: ecommerce.currency
Event Parameters:
x-fb-cd-content_type - product
currency - BDT
value -
x-fb-cd-content_ids -
items -
transaction_id -
tax -
shipping -
coupon -
Trigger: event equals - purchase
Tag:
Data Layer Source: https://developers.google.com/tag-manager/ecommerce-ga4
.png)