Skip to main content

tvScientific Pixel Implementation

How to get started with pixel tracking

Overview

tvScientific pixels collect website activity and conversion data needed for targeting, comprehensive reporting, and modeling in the tvScientific platform. You can implement pixels directly in your site’s code or through a tag manager.

Recommended setup

For the most complete measurement, implement:

  1. Universal Site Pixel needed to track and attribute users to tvScientific advertising and to enable additional pixels

  2. Visited Website Pixel to track user behavior across pages on the client’s website

  3. Conversion Pixels for business-critical actions you want to measure, such as purchases, registrations, leads, cart additions, or checkout starts

This combination establishes sitewide measurement and captures the conversion signals needed to evaluate and optimize campaign performance.

Before you begin

You will need:

  • Your tvScientific Pixel ID, provided by the tvScientific onboarding team

  • Access to your website codebase or tag manager

  • Access to the dynamic values required for the events you plan to track, such as order ID, purchase amount, or customer status

Use dynamic values whenever available. A unique event identifier is required for deduplication on applicable conversion events.

Universal Site Pixel

The Universal Site Pixel (USP) is required for all tvScientific tracking. It must be the first tvScientific script to load before any event pixels fire.

Direct implementation

Add the following script to the global <head> of your website so it loads on every page. Replace <TVSCI PIXEL ID HERE> with the Pixel ID supplied by tvScientific.

<script src="https://assets.tvscipixel.com/<TVSCI PIXEL ID HERE>.js"></script>

Google Tag Manager

Create a Custom HTML tag containing the USP script and set it to trigger on All Pages.

Visited Website Pixel

The Visited Website Pixel captures page-view activity and fires once per session. Install it on every page you want to measure after the Universal Site Pixel loads.

Direct implementation

Place this snippet as early as possible within the <body> of each tracked page:

<script>
tvsci.fireUniversalSitePixel();
</script>

Google Tag Manager

Create a Custom HTML tag for the Visited Website Pixel and use Tag Sequencing to ensure it fires only after the USP has loaded successfully. For additional guidance, see the Google Tag Manager implementation guide.

Complete Purchase Pixel

Use the Complete Purchase Pixel to record a completed transaction. Fire it only after a successful purchase, ideally on the order confirmation or thank-you page.

Avoid triggering purchase pixels directly from a button whenever possible. A confirmation-page implementation is more reliable because it confirms that the transaction completed successfully.

Required values

  • orderId: A unique order identifier used for deduplication

  • orderAmount: Transaction subtotal, excluding tax and shipping and reflecting discounts

Direct implementation

Replace each placeholder with a dynamic value from your website. Remove optional parameters you do not plan to send.

<script>
tvsci.fireCompletePurchasePixel({
orderId: "{{OrderId}}",
orderAmount: {{Amount, without currency symbol}},
lastTouchChannel: "{{LastTouchChannel}}",
customerId: "{{CustomerId}}",
customerStatus: "{{CustomerStatus}}",
note: "{{Note}}",
promoCode: "{{PromoCode}}",
currency: "USD",
items: {{ItemsArray}}
});
</script>

Example

<script>
tvsci.fireCompletePurchasePixel({
orderId: "1234",
orderAmount: 29.00,
lastTouchChannel: "Paid_Search",
currency: "USD",
items: [
{
"SKU": "BOOK-001",
"CAT": "Books",
"PR": 24.00,
"QTY": 1
},
{
"SKU": "STICKER-001",
"CAT": "Accessories",
"PR": 5.00,
"QTY": 1
}
]
});
</script>

Google Tag Manager

Create a Custom HTML tag for the purchase pixel. Trigger it only on the purchase confirmation page or the successful purchase data-layer event, and sequence it after the USP.

Complete Purchase Pixel with Auto-Generated Order ID

Use this version only when your site cannot provide a unique order ID. The pixel generates an ID automatically and retains it for the browser session. If the pixel fires again during that session, it reuses the same generated ID.

This approach is useful for limited data-layer access, but a platform-generated unique order ID is preferred when available.

<script>
tvsci.fireCompletePurchasePixelWithAutoOrderId({
orderAmount: {{Amount, without currency symbol}},
lastTouchChannel: "{{LastTouchChannel}}",
customerId: "{{CustomerId}}",
customerStatus: "{{CustomerStatus}}",
note: "{{Note}}",
promoCode: "{{PromoCode}}",
currency: "USD",
items: {{ItemsArray}}
});
</script>

If a dynamic amount is unavailable, you may hardcode an amount only when every tracked conversion has the same known value. Do not hardcode a value for variable-price transactions.

Custom Event Pixel

Use a Custom Event Pixel to measure a successful user action other than a purchase. Fire the pixel after the action is completed.

Supported event names:

  • lead_generated

  • add_to_cart

  • complete_registration

  • start_checkout

  • trial_started

  • viewed_product

  • complete_purchase

Contact the tvScientific integration team if you need to track an event not listed above.

Direct implementation

Replace the event name and placeholders with the appropriate values. For sale events, uniqueEventIdentifier (u4) is the unique event ID and orderAmount (u2) is the amount.

<script>
tvsci.fireCustomPixel('[[Your_Event_Name_Here]]', {
uniqueEventIdentifier: "{{UniqueEventIdentifier}}",
orderAmount: {{Amount, without currency symbol}},
lastTouchChannel: "{{LastTouchChannel}}",
customerId: "{{CustomerId}}",
customerStatus: "{{CustomerStatus}}",
note: "{{Note}}",
items: {{ItemsArray}},
promoCode: "{{PromoCode}}",
currency: "USD"
});
</script>

Example: Product View

<script>
tvsci.fireCustomPixel('viewed_product', {
uniqueEventIdentifier: "127856838073",
lastTouchChannel: "PaidSearch",
note: "LEGO Star Wars"
});
</script>

Google Tag Manager

Create a Custom HTML tag for each custom event. Trigger each tag only after its associated user action succeeds, and use Tag Sequencing to ensure it loads after the USP.

Custom Event Pixel with Auto-Generated Order ID

Use this version when you do not have access to a unique event identifier. The pixel generates an ID and reuses it for the duration of the browser session.

<script>
tvsci.fireCustomPixelWithAutoOrderId('[[Your_Event_Name_Here]]', {
orderAmount: {{Amount, without currency symbol}},
lastTouchChannel: "{{LastTouchChannel}}",
customerId: "{{CustomerId}}",
customerStatus: "{{CustomerStatus}}",
note: "{{Note}}",
items: {{ItemsArray}},
promoCode: "{{PromoCode}}",
currency: "USD"
});
</script>

Example: Add to Cart

<script>
tvsci.fireCustomPixelWithAutoOrderId('add_to_cart', {});
</script>

Validate your implementation

Before publishing your changes:

  1. Confirm the USP loads on every tracked page and before all tvScientific event pixels.

  2. Confirm the Visited Website Pixel fires once per session.

  3. Complete a test conversion and verify that the expected conversion pixel fires only after the action succeeds.

  4. Verify that required values, including the event ID and amount where applicable, are populated correctly.

  5. If using GTM, utilize the GTM Preview mode or browser developer tools to confirm tag order and successful network requests.

Parameter reference

Do not pass personally identifiable information in customerId.

Parameter

Description

Required

orderAmount

Transaction subtotal before tax and shipping, after discounts.

Required for purchase and sale events

orderId

Unique order, registration, lead, or event identifier used for deduplication.

Required where applicable

lastTouchChannel

The most recent marketing channel that brought the user to the site. Pass an empty string if unavailable.

Optional

customerId

A non-PII identifier for the customer account.

Optional

customerStatus

New or Existing.

Optional

note

Custom contextual detail for the event.

Optional

items

Item-level transaction data.

Optional

promoCode

One promotional code applied to the order.

Optional

currency

Three-letter ISO 4217 currency code, such as USD.

Optional

A Note on the Item-level Data Field

Pass item data as an array of objects. Each item can include:

  • SKU: Product SKU

  • CAT: Product category

  • PR: Per-item amount after discounts and before tax

  • QTY: Quantity purchased

[
{
"SKU": "LEGO-STAR_WARS_MAN1",
"CAT": "Toys",
"PR": 8.99,
"QTY": 4
},
{
"SKU": "YELLOW_CHAIR-10",
"CAT": "Furniture",
"PR": 1000.99,
"QTY": 1
}
]

Did this answer your question?