Facebook Pixel Conversion Code Generator
Create custom Facebook Pixel tracking code for your website with our easy-to-use tool
Pixel Configuration
You can find this in your Facebook Events Manager
Conversion Event
Standard Events
Custom Events
PageView
Tracks when someone views a page
ViewContent
Tracks when someone views your content
AddToCart
Tracks when someone adds an item to cart
InitiateCheckout
Tracks when checkout flow starts
Purchase
Tracks purchases or checkout completions
Lead
Tracks when someone signs up or shows interest
Generated Code
Facebook Pixel Tracking Code
// Your generated code will appear here
Implementation Guide
How to use your Facebook Pixel code:
- Copy the generated code above
- Paste it between the <head> tags of your website
- For conversion events, place the event code on specific pages (thank you page, etc.)
- Test your implementation using Facebook Pixel Helper browser extension
- Verify tracking in Facebook Events Manager
Note: The base Pixel code needs to be on every page. Event codes should be placed only on relevant pages.
Code copied to clipboard!
`;
// Full code output
const fullCode = baseCode + '\n\n' + eventCode;
// Display in code box
document.getElementById('generated-code').textContent = fullCode;
}
// Generate event code
function generateEventCode(eventName, containerId) {
const container = document.getElementById(containerId);
const paramRows = container.querySelectorAll('.param-row');
let params = {};
let hasParams = false;
paramRows.forEach(row => {
const nameInput = row.querySelector('.param-name');
const valueInput = row.querySelector('.param-value');
const name = nameInput.value.trim();
const value = valueInput.value.trim();
if (name && value) {
params[name] = value;
hasParams = true;
}
});
let eventCode = `
`;
return eventCode;
}
// Copy code to clipboard
function copyCode() {
const code = document.getElementById('generated-code').textContent;
navigator.clipboard.writeText(code).then(() => {
const notification = document.getElementById('notification');
notification.style.display = 'block';
setTimeout(() => {
notification.style.display = 'none';
}, 2000);
});
}
// Initialize with some code
generateCode();
});