Install Meta Pixel (formerly Facebook Pixel) on your 3dcart/Shift4Shop store to track conversions, optimize ads, and build targeted audiences.
Prerequisites
Before installing Meta Pixel:
Create Meta Pixel:
- Go to Meta Events Manager
- Create a new pixel or use existing pixel
- Note your Pixel ID (15-16 digit number)
Verify Store Access:
- Admin access to 3dcart/Shift4Shop
- Access to Settings → Design → Advanced
Choose Implementation Method:
- Direct Implementation: Manual code in Global Footer
- GTM Implementation: Via Google Tag Manager (recommended)
- Native Integration: If available in your 3dcart version
Method 1: Direct Implementation (Manual)
Install Meta Pixel directly in Global Footer for full control.
Step 1: Get Meta Pixel Code
Go to Meta Events Manager:
- Visit business.facebook.com/events_manager
- Select your pixel
Get Pixel Code:
- Click Settings
- Click Install Pixel
- Choose Install code manually
- Copy the base pixel code
Step 2: Install Base Pixel Code
Navigate to Global Footer:
- Go to Settings → Design → Advanced
- Scroll to Global Footer section
Add Meta Pixel Base Code:
<!-- Meta Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', 'YOUR_PIXEL_ID');
fbq('track', 'PageView');
</script>
<noscript>
<img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=YOUR_PIXEL_ID&ev=PageView&noscript=1"/>
</noscript>
<!-- End Meta Pixel Code -->
Important: Replace YOUR_PIXEL_ID with your actual pixel ID (in two places).
- Save Changes
Step 3: Verify Installation
Use Meta Pixel Helper:
- Install Meta Pixel Helper Chrome Extension
- Visit your 3dcart store
- Click the extension icon
- Verify pixel is firing with green checkmark
- Check that pixel ID matches yours
Check in Events Manager:
- Go to Meta Events Manager
- Click Test Events
- Enter your store URL
- Visit your store in a new tab
- Verify PageView event appears in Test Events
Method 2: GTM Implementation (Recommended)
Install Meta Pixel through Google Tag Manager for easier management.
Prerequisites
- GTM installed on your 3dcart store (GTM Setup Guide)
Step 1: Create Meta Pixel Tag in GTM
In GTM, create a new tag:
- Tag Type: Custom HTML
- Tag Name:
Meta Pixel - Base Code
Add Meta Pixel Code:
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', 'YOUR_PIXEL_ID');
fbq('track', 'PageView');
</script>
<noscript>
<img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=YOUR_PIXEL_ID&ev=PageView&noscript=1"/>
</noscript>
Replace YOUR_PIXEL_ID with your pixel ID.
Set Trigger:
- Trigger: Initialization - All Pages
- This ensures pixel loads on every page
Save Tag
Step 2: Create PageView Tag (Optional)
If you want separate control over PageView events:
Create new tag:
- Tag Type: Custom HTML
- Tag Name:
Meta Pixel - PageView
Add Code:
<script>
fbq('track', 'PageView');
</script>
Set Trigger:
- Trigger: All Pages
Tag Sequencing:
- Setup Tag:
Meta Pixel - Base Code - This ensures base code loads first
- Setup Tag:
Step 3: Publish Container
- Click Submit in GTM
- Name version: "Meta Pixel Installation"
- Click Publish
Step 4: Verify GTM Implementation
Use GTM Preview Mode:
- Click Preview in GTM
- Connect to your store
- Verify Meta Pixel tags fire
Use Meta Pixel Helper:
- Visit your store
- Check Pixel Helper shows pixel firing
- Verify correct pixel ID
Method 3: Native 3dcart Integration
Shift4Shop (formerly 3dcart) includes a built-in Facebook Pixel field in the admin dashboard.
- Go to Marketing → Analytics (or Settings → General → Analytics on older versions)
- Find the Facebook Pixel ID field
- Enter your Pixel ID and save
Limitations
- Basic PageView tracking only
- Limited event customization
- For advanced tracking, use Method 1 or 2
Add Standard Events
After base pixel is installed, add standard Meta events.
ViewContent (Product Pages)
Track when customers view products:
<script>
// Only on product pages
if (window.location.pathname.indexOf('/product') !== -1) {
fbq('track', 'ViewContent', {
content_ids: ['[productid]'],
content_name: '[productname]',
content_type: 'product',
value: parseFloat('[productprice]'),
currency: 'USD'
});
}
</script>
AddToCart
Track add to cart actions:
<script>
document.addEventListener('DOMContentLoaded', function() {
var addToCartForms = document.querySelectorAll('form[action*="addtocart"]');
addToCartForms.forEach(function(form) {
form.addEventListener('submit', function() {
var quantity = form.querySelector('input[name="quantity"]')?.value || 1;
fbq('track', 'AddToCart', {
content_ids: ['[productid]'],
content_name: '[productname]',
content_type: 'product',
value: parseFloat('[productprice]') * parseInt(quantity),
currency: 'USD'
});
});
});
});
</script>
InitiateCheckout
Track when checkout begins:
<script>
// On checkout page load
if (window.location.pathname.indexOf('/checkout') !== -1) {
fbq('track', 'InitiateCheckout', {
content_type: 'product',
currency: 'USD',
value: parseFloat('[carttotal]') // Use cart total template variable
});
}
</script>
Purchase
Track completed purchases on order confirmation:
<script>
// Only on order confirmation/receipt page
if (window.location.pathname.indexOf('/receipt') !== -1 ||
window.location.pathname.indexOf('/thankyou') !== -1) {
var orderId = '[invoicenumber]';
// Prevent duplicate tracking
if (!sessionStorage.getItem('fb_purchase_' + orderId)) {
fbq('track', 'Purchase', {
content_type: 'product',
value: parseFloat('[invoicetotal]'),
currency: 'USD',
transaction_id: orderId
});
sessionStorage.setItem('fb_purchase_' + orderId, 'true');
}
}
</script>
See Meta Pixel Event Tracking for complete event implementation.
Advanced Configuration
Multiple Pixels
Track with multiple pixels (e.g., main pixel + partner pixel):
<script>
// Initialize both pixels
fbq('init', 'YOUR_PIXEL_ID_1');
fbq('init', 'YOUR_PIXEL_ID_2');
// Track PageView on both
fbq('track', 'PageView');
// Track event on specific pixel
fbq('trackSingle', 'YOUR_PIXEL_ID_1', 'AddToCart', {
value: 25.00,
currency: 'USD'
});
</script>
Advanced Matching
Improve match rates with customer data:
<script>
// Only if customer is logged in
var customerId = '[customerid]';
if (customerId && customerId !== '[customerid]') {
fbq('init', 'YOUR_PIXEL_ID', {
em: '[customeremail]', // Customer email (hashed automatically)
fn: '[customerfirstname]',
ln: '[customerlastname]',
ph: '[customerphone]',
ct: '[customercity]',
st: '[customerstate]',
zp: '[customerzipcode]',
country: '[customercountry]'
});
} else {
fbq('init', 'YOUR_PIXEL_ID');
}
fbq('track', 'PageView');
</script>
Note: Meta automatically hashes personally identifiable information (PII).
Custom Events
Track custom business events:
<script>
// Custom event example
fbq('trackCustom', 'NewsletterSignup', {
content_category: 'Newsletter',
content_name: 'Footer Signup Form'
});
</script>
Verify Pixel Installation
Meta Pixel Helper (Browser Extension)
Install Extension:
Test Pixel:
- Visit your store
- Click extension icon
- Should show: ✓ Meta Pixel (green)
- Click to see events fired
Check for Issues:
- Red icon = errors
- Yellow icon = warnings
- Green = working correctly
Meta Events Manager - Test Events
Go to Events Manager:
Click Test Events:
- Enter your store URL
- Visit your store in new tab
- See real-time events in Test Events tab
Verify Events:
- PageView on all pages
- ViewContent on product pages
- AddToCart when adding products
- Purchase on order confirmation
Browser Console Testing
// Check if fbq is defined
console.log(typeof fbq);
// Should return 'function'
// Check pixel queue
console.log(fbq.queue);
// Test event manually
fbq('track', 'ViewContent', {test: true});
Troubleshooting
Pixel Not Loading
Check:
- Pixel ID is correct
- Code is in Global Footer
- No JavaScript errors in console (F12)
- Ad blockers disabled (test in incognito)
Debug:
// Check if fbq exists
if (typeof fbq === 'undefined') {
console.log('Meta Pixel not loaded');
} else {
console.log('Meta Pixel loaded successfully');
}
Events Not Firing
Common Issues:
- Page type detection incorrect
- Template variables not available on page
- JavaScript errors preventing execution
- Ad blockers blocking requests
Fix:
- Check browser console for errors
- Verify page type with
console.log(window.location.pathname) - Test in incognito mode without ad blockers
Duplicate Events
Cause: Multiple pixel implementations
Check:
- Native integration + manual code
- GTM tag + direct code in Global Footer
- Pixel code in multiple locations
Fix: Use only ONE implementation method
Template Variables Not Working
Problem: Showing literal [productid] in events
Cause: Variable used on wrong page type
Fix:
<script>
// Only use product variables on product pages
if (window.location.pathname.indexOf('/product') !== -1) {
fbq('track', 'ViewContent', {
content_ids: ['[productid]'],
content_name: '[productname]'
});
}
</script>
Privacy and Compliance
GDPR Compliance
Respect user consent preferences:
<script>
// Check for user consent (adjust based on your consent tool)
if (userConsentGranted()) {
fbq('init', 'YOUR_PIXEL_ID');
fbq('track', 'PageView');
} else {
// Don't load pixel
console.log('User has not consented to tracking');
}
</script>
Limited Data Use
For California Privacy (CCPA):
<script>
fbq('dataProcessingOptions', ['LDU'], 1, 1000);
fbq('init', 'YOUR_PIXEL_ID');
fbq('track', 'PageView');
</script>
Performance Optimization
Async Loading
Meta Pixel loads asynchronously by default, but ensure:
<script>
// Pixel loads async - don't modify unless necessary
t.async=!0;
</script>
Minimize Event Parameters
- Include only necessary parameters
- Don't track PII beyond advanced matching
- Limit custom data
Consolidate Through GTM
- Manage all tracking through GTM
- Better performance than multiple direct implementations
- Easier debugging and testing
Next Steps
- Meta Pixel Event Tracking - Complete event implementation
- GTM Data Layer - Advanced GTM setup
- Troubleshoot Events Not Firing - Debug tracking issues
Additional Resources
- Meta Pixel Setup Guide
- Meta Events Manager
- 3dcart Template Variables (Shift4Shop help articles are no longer available; see your store's admin panel)
- Meta Pixel Helper Extension