How to use the Pixel Code Generator
- Tick each platform you use and enter its ID. You’ll find it in that platform’s ads manager.
- Choose where you’ll install the code, and whether it should wait for cookie consent.
- Copy the code and add it to your site, following the note under the code.
- Publish your site, then confirm that every pixel fires with the Tracking & Pixel Checker.
What is a tracking pixel?
A tracking pixel is a small piece of code from an ad platform. It tells the platform when someone visits your site, so you can measure your ads, build audiences and show ads to past visitors. The name comes from the tiny invisible image these tools once used.
Base code and event code
The base code goes on every page and records page views. Event code records actions such as a lead or purchase. Install the base code here first, then create your events with the Ad Pixel Event Code Generator.
Waiting for cookie consent
Choose After consent and the code goes inside a loadPixels() function. Nothing loads until your consent banner calls that function. It leaves out the no-JavaScript fallback, because that image would load without consent. Need a banner? Try the Cookie Consent Banner Generator.
Install it once
Don’t add the same pixel in two places, such as a theme setting and your own code. Double installs count every page view twice and skew your reports.
For a full walkthrough, read how to install a tracking pixel. Platforms sometimes update their code, so if yours gives you a different snippet in its ads manager, use that one.
Also searched as: tracking pixel generator, install tracking pixel, pixel install code, meta pixel code, tiktok pixel code, linkedin insight tag, pinterest tag code, retargeting pixel code.
Tools that pair well with the Pixel Code Generator
- UTM Builder — Add utm_source, utm_medium, utm_campaign and friends to any link, see which GA4 channel the visit will land in, and tag a whole list of URLs at once.
- Meta Conversions API Generator — Send conversions to Meta from your server.
- GTM Snippet Generator — Enter your GTM container ID and get the Google Tag Manager install code for the <head> and <body>, with Consent Mode v2 defaults placed before the container so every tag inside it waits for consent.
- A/B Test Significance Calculator — Did version B really win, or was it luck?