Skip to main content

How to Place a Pixel

Instructions for placing the base code and event code on your website

Once you've created a website conversion pixel, the next step is placing it on your website so it can start tracking actions.

Before you start: Make sure you've already created your pixel and set your attribution rules. We recommend placing your pixel before your campaign launches, so tracking is live from day one.

Understanding the two parts of your pixel

Your pixel is made up of two pieces of code, and each goes in a different place:

  • Base code — initializes tracking and automatically records page views. This goes on every page of your site.

  • Event code — tracks a specific action, like a purchase or a form fill. This goes only on the page where that action happens (or is confirmed).

You'll always place the base code first. Event codes won't fire without it.

How to place the pixel

  1. Copy your base code from the pixel config page.

  2. Open your website's global header template (the code between the <head> and </head> tags). If your site uses a global header, you only need to add it once. If not, add it to the header of every page.

  3. Paste the base code just above the closing </head> tag, below any existing code.

  4. To track a specific action, copy the matching event code and place it on that action's page — inside the <body> tags — so it fires when the page loads or the action is completed.

  5. Save and publish your website changes.

Where each code goes

Code / Parameter

What it tracks

Where to place it

Base code

Initializes tracking and records page views

In the <head> section of every page, just above the closing </head> tag

Revenue (Purchase)

The sale and its dollar value

On the order confirmation page shown after checkout completes, with the revenue value passed dynamically

Order ID

A unique identifier for each transaction

On the order confirmation page, passed alongside the Purchase event to de-duplicate and match orders

User ID

A unique identifier for the customer

On the page where the user is identified (e.g., post-login or confirmation page)

Product

The specific item(s) associated with the action

On the product, cart, or confirmation page

Custom

Any additional value that matters to your business

On the page where that action or value occurs

How to test your pixel is working

  1. Use browser tools (e.g., Chrome DevTools) or a pixel helper extension to confirm your pixel is firing correctly.

  2. Trigger conversion events manually to verify attribution is being captured.

  3. Make sure pixels are not firing redundantly on every page if only specific pages/events need to be tracked.

  4. Return to Pixel Config page after 24 hours, and monitor over ~7 days to ensure DIRECTV Ads Manager is recording and tracking counts in-line with your internal site analytics.

Need help? If you have questions or need assistance setting up or validating your pixel, please contact [email protected]. Our team is happy to help with implementation, QA, and best practices.

Did this answer your question?