Website Pixel Integration
Embed the tracking pixel directly on your website
Website Pixel Integration
This guide shows how to integrate the tracking pixel directly on your website by adding the script to your HTML.
Step 1: Locate HTML Header Files
Find the file(s) on your website that contain the HTML header code. If you're not sure where it's located, search for files containing the closing tag: </head>
Step 2: Embed the Pixel Script
In each file containing the HTML header, embed the tracking script just before the </head> tag:
<script src="{{PIXEL_SCRIPT_URL}}" async></script>Replace
{{PIXEL_SCRIPT_URL}}with the actual script URL provided by your account manager.
Loading the Script After User Consent
If your website requires user consent for tracking (for example under GDPR), do not embed the script tag directly. Load the script only after the user has given consent in your consent management platform (CMP):
<script>
function loadTrackingPixel() {
if (window.trackingPixelLoaded) return;
window.trackingPixelLoaded = true;
var script = document.createElement('script');
script.src = '{{PIXEL_SCRIPT_URL}}';
script.async = true;
document.head.appendChild(script);
}
</script>Call loadTrackingPixel() from your CMP:
- On page load, when the user has already given consent on an earlier visit
- Right after the user gives consent on the current page
E-commerce events pushed to the dataLayer before the script loads are still processed, so events from the current page are not lost.
Step 3: Publish Changes
Save all modified files and upload the changes to your website server (for example, using FTP or your deployment pipeline).
Verification
After publishing, verify the integration by:
- Opening your website in a browser
- Opening Developer Tools (F12) > Network tab
- Confirming the pixel script loads successfully
- Checking that e-commerce events are being sent
Updated about 1 month ago
