Docs menu · GTM DataLayer
Getting Started
Integrations
Server-side GTM
COD Order Protection
Advanced Features
Downloads
Tools & Support
Docs / Integrations
GTM with DataLayer
For Laravel, PHP, or any site using Google Tag Manager
Select Container Type:
sGTM Mode: Use your PixelFly-hosted Server-Side GTM container for full GTM control.
Proxy Mode: PixelFly routes events directly to ad platforms. No sGTM server needed.
Setup DataLayer Events
Push e-commerce events to the dataLayer from your application code. Use GA4 standard event format.
// Example: Add to Cart event
dataLayer.push({
event: 'add_to_cart',
ecommerce: {
currency: 'BDT',
value: 1500,
items: [{
item_id: 'SKU123',
item_name: 'Product Name',
price: 1500,
quantity: 1
}]
},
user_data: {
email: 'customer@example.com',
phone: '+8801712345678'
}
});
Create your sGTM container in PixelFly
PixelFly → Containers → new sGTM container. Note its server URL (e.g. https://abcd1234.pixelfly.io, or your custom domain). See sGTM Hosting.
Import the web and server containers
Import each into Google Tag Manager (Admin → Import Container): the web one into your website’s GTM, the server one into your server GTM.
Meta Pixel, GA4, Google Ads and TikTok in the browser; Meta CAPI, GA4 and TikTok on the server; reload protection; COD Order Protection (off until you switch it on).
Fill in your IDs
- Web: the Google Tag’s server container URL = your sGTM URL;
Meta Pixel ID-000= your Pixel ID. - Server: Facebook CAPI Pixel ID and access token; GA4-Server Side Measurement ID.
- Cash on delivery? See COD with our sGTM containers.
Publish & test
Publish the server container, then the web one, and check both in GTM Preview.
Import the proxy container
Import it into your website’s Google Tag Manager (Admin → Import Container). It’s built on our sGTM web container and sends server-side events to PixelFly’s API.
Download Proxy Web Container (.json)Fill in your API key and IDs
PixelFly API Key= your container’s API Key (container page in PixelFly).Meta Pixel ID-000andGA4-FM ID(your GA4 Measurement ID).PixelFly - Server URL: leavehttps://track.pixelfly.io/eunless you set up a tracking domain.- In PixelFly, add Receivers for the platforms the server-side events should reach (Meta, GA4, TikTok, Google Ads).
Publish & test
Publish and check GTM Preview and PixelFly’s event logs. Cash on delivery? See COD with our proxy container.
DataLayer Event Reference
// Page View
dataLayer.push({ event: 'page_view' });
// Purchase
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: 'purchase',
eventId: 'purchase_ORDER-123', // unique per order
payment_method: 'cod', // or 'bkash', 'card', …
ecommerce: {
transaction_id: 'ORDER-123',
currency: 'BDT',
value: 5000,
tax: 0,
shipping: 100,
items: [{ item_id: 'SKU123', item_name: 'Product', price: 2500, quantity: 2 }]
},
user_data: {
email: 'customer@example.com',
phone: '+8801712345678'
}
});