SEO & Marketing

How to Install a Tracking Pixel

A tracking pixel connects your website to your ad accounts. Installing one takes about ten minutes: get your ID, generate the code, add it to your site, then test it.

Beginner · 8 min read · Updated November 1, 2026

How to Install a Tracking Pixel

What a pixel does

A pixel is a small script from an ad platform. It tells the platform when someone visits your site or takes an action. That lets you measure which ads work, build audiences and show ads to past visitors.

1. Find your pixel ID

  • Meta: Events Manager, under your data source.
  • TikTok: Events Manager, under Web Events.
  • LinkedIn: Campaign Manager, under Insight Tag. It’s called a partner ID.
  • Pinterest: Ads Manager, under Conversions.
  • Google Ads: Goals, under Google tag. It starts with AW-.

Menu names change from time to time, so search your platform’s help pages if you can’t find one.

2. Generate the code

Enter your IDs in the Pixel Code Generator. It puts all your pixels into one snippet and tells you where to paste it. If you’re only using one platform, try the Meta Pixel, TikTok Pixel or LinkedIn Insight Tag generator.

3. Add it to your site

  • Any website: paste it before the closing </head> tag on every page, ideally in a shared header.
  • Webflow: go to Site settings → Custom code, paste it into Head code, then publish. This needs a paid site plan.
  • WordPress: use a header code plugin, or a child theme. Don’t edit a parent theme, because updates remove your change.
  • Shopify: look for the platform’s sales channel app first. For custom code, use Settings → Customer events and add a custom pixel.
  • Google Tag Manager: add a Custom HTML tag, or a ready-made template if one exists, and fire it on all pages.

Pick one method only. If a pixel is installed twice, every visit is counted twice.

Marketing pixels usually set cookies, and laws such as the GDPR generally require consent before they load. This guide isn’t legal advice, so check what applies to your visitors.

In the generator, choose After consent. Your code then sits inside a function, and your banner runs it when the visitor agrees:

acceptButton.addEventListener('click', loadPixels);

Remember returning visitors too. If your banner stored their choice, call loadPixels() on page load for those who already agreed. The Cookie Consent Banner Generator can create a banner for you.

5. Test it

  1. Publish your site and open it in a private window.
  2. Run the page through the Tracking & Pixel Checker.
  3. Open your platform’s test tool. Meta has Test events, and TikTok has Test Events too.
  4. Visit a page and confirm that the event appears.

Ad blockers stop many pixels, so turn yours off while testing. For the same reason, your reports will never capture every visitor.

6. Track conversions

Page views are only the start. Use the Ad Pixel Event Code Generator to track leads and purchases. For more reliable numbers, add server-side tracking with the Meta Conversions API Generator. Tag your campaign links with the UTM Builder so you can compare them in analytics too.

If your pixel doesn’t fire

  • The code isn’t published. Many platforms need you to publish changes.
  • The ID is wrong. Copy it again from your ads manager.
  • Consent is blocking it. Accept cookies, then reload.
  • An ad blocker is on. Turn it off and test again.
  • A security policy blocks it. Your site’s Content-Security-Policy must allow the platform’s domains. Check it with the Security Headers Checker.

Frequently asked questions

How long does a pixel take to show data?
Test tools usually show events within minutes. Reports can take longer to update.
Can I install several pixels on one site?
Yes. Each adds a little to your page load, so keep only those you use.
Should I use Google Tag Manager for pixels?
It’s useful if you have several tags or want to change them without editing your site. For one pixel, direct install is fine.
Do pixels slow down my website?
A little. They load asynchronously, so the effect is usually small, but several together can add up. Test with the Page Speed Test.

Keep reading