MediaMath Setup & Implementation | OpsBlu Docs

MediaMath Setup & Implementation

How to implement MediaMath programmatic tracking with pixel deployment and conversion events.

MediaMath's TerminalOne platform is an enterprise demand-side platform (DSP) for programmatic media buying across display, video, mobile, native, and connected TV inventory. Conversion tracking in MediaMath relies on universal pixels and event-specific pixels deployed on your website, feeding data back to TerminalOne's Brain optimization engine. Without accurate pixel data, Brain cannot optimize bids, audience segments cannot populate for retargeting, and attribution reports show spend without outcomes.

Why Proper Implementation Matters

Brain Optimization Requires Conversion Data

MediaMath's Brain is the machine learning engine behind automated bidding. It uses conversion signals to:

  • Calculate effective CPA and ROAS across inventory sources, exchanges, and audience segments
  • Adjust bid prices in real time based on predicted conversion probability per impression
  • Allocate budget across strategies and campaigns toward the highest-performing segments
  • Build predictive models that identify which users are most likely to convert

Without pixel data flowing correctly, Brain has no training signal. Campaigns run on basic reach/frequency optimization instead of performance optimization -- the equivalent of flying blind with programmatic spend.

Audience Activation Depends on Pixel Data

MediaMath pixel data powers:

  • Retargeting segments: Users who visited your site but did not convert
  • Suppression lists: Exclude recent converters from prospecting campaigns
  • Lookalike modeling: Seed audiences for TerminalOne's audience expansion
  • Sequential messaging: Show different creatives based on funnel stage
  • Product-level retargeting: Dynamic creative optimization based on viewed products

Attribution and Reporting

Incorrect pixel implementation causes:

  • Conversion under-reporting: Media appears less effective than it is, leading to budget cuts
  • Duplicate conversions: Inflated ROAS that misleads optimization and stakeholder reporting
  • Misattribution: Conversions credited to the wrong strategy or campaign
  • Missing revenue data: Sales pixels without value parameters show conversion counts but no ROAS

Pre-Implementation Planning

Access and Permissions

TerminalOne Platform Access:

  1. Request an account at t1.mediamath.com
  2. Obtain your Organization ID and Advertiser ID
  3. Ensure you have "Advertiser Admin" permissions for pixel management
  4. Request API credentials if planning server-side integration

Required Roles:

Role Permissions Use Case
Organization Admin Full platform access Account setup, billing
Advertiser Admin Pixel management, campaign creation Implementation lead
Campaign Manager Campaign and strategy management Day-to-day optimization
Reporter Read-only reporting access Stakeholder dashboards

Coordination Requirements:

  • Media team: Campaign structure, strategy goals, and budget allocation
  • Engineering team: Pixel deployment and data layer integration
  • Analytics team: Attribution window settings and reporting requirements
  • Privacy/Legal team: Consent management and data processing agreements

Pixel Architecture Overview

MediaMath uses a two-tier pixel system:

  1. Universal Pixel: A single pixel deployed on every page of your website. It captures all pageview activity and provides the foundation for audience building and attribution.

  2. Event Pixels: Specific pixels that fire on conversion events (purchase, lead submit, signup). These carry conversion data (value, order ID) back to TerminalOne.

Plan Your Event Inventory:

Event Name Pixel Type Parameters Trigger
Site Visit Universal page_url, referrer All pages
Product View Event product_id, category, price Product detail pages
Add to Cart Event product_id, quantity, value Add-to-cart action
Purchase Event (Revenue) order_id, revenue, currency Order confirmation
Lead Submit Event form_name, lead_type Form submission
Signup Event plan_type Account creation

Attribution Configuration

Configure attribution windows before pixel deployment:

Setting Options Recommendation
Click lookback 1-90 days 30 days (standard)
Impression lookback 1-90 days 14 days (display), 30 days (video)
Conversion counting Every, One per user, One per session One per user for leads, Every for purchases
Cross-device Enabled/Disabled Enabled (uses MediaMath identity graph)

Implementation Walkthrough

Step 1: Generate Universal Pixel in TerminalOne

  1. Log in to TerminalOne at t1.mediamath.com
  2. Navigate to Advertiser > Pixels (under the Setup menu)
  3. Click Create Pixel
  4. Configure:
    • Pixel Name: "Universal Pixel - [Brand Name]"
    • Type: Universal
    • Advertiser: Select your advertiser account
  5. Save and copy the generated pixel code

Step 2: Deploy Universal Pixel on All Pages

The universal pixel must fire on every page of your website to capture browsing behavior for audience building.

Direct Implementation:

<!-- MediaMath Universal Pixel -->
<script>
  (function(w, d, t, u, n, a, m) {
    w['MathTagObject'] = n;
    w[n] = w[n] || function() { (w[n].q = w[n].q || []).push(arguments) };
    a = d.createElement(t);
    m = d.getElementsByTagName(t)[0];
    a.async = 1;
    a.src = u;
    m.parentNode.insertBefore(a, m);
  })(window, document, 'script',
    'https://pixel.mathtag.com/event/js?mt_id=YOUR_PIXEL_ID&mt_adid=YOUR_ADVERTISER_ID&mt_exem=&mt_excl=&v1=&v2=&v3=&s1=&s2=&s3=',
    'mtag');

  // Initialize with page-level data
  mtag('send', 'pageview', {
    'mt_id': 'YOUR_PIXEL_ID',
    'mt_adid': 'YOUR_ADVERTISER_ID'
  });
</script>

Via Google Tag Manager:

  1. Create a new Custom HTML tag
  2. Paste the universal pixel code
  3. Set trigger: All Pages
  4. If using consent management, add a Consent trigger condition

Via MediaMath Tag Manager:

MediaMath offers its own tag management solution that can deploy the universal pixel alongside event pixels with server-side capabilities.

Step 3: Deploy Event Pixels for Conversions

Create event-specific pixels for each conversion type.

Purchase/Revenue Event:

<!-- MediaMath Purchase Pixel -->
<script>
  mtag('send', 'conversion', {
    'mt_id': 'YOUR_PURCHASE_PIXEL_ID',
    'mt_adid': 'YOUR_ADVERTISER_ID',
    'mt_exem': '',  // Hashed email for enhanced matching
    'v1': orderTotal,           // Revenue value
    'v2': orderId,              // Transaction ID (deduplication)
    'v3': itemCount,            // Number of items
    's1': customerType,         // Custom string: 'new' or 'returning'
    's2': productCategory,      // Custom string: product category
    's3': paymentMethod         // Custom string: payment method
  });
</script>

Lead Submission Event:

<!-- MediaMath Lead Pixel -->
<script>
  mtag('send', 'conversion', {
    'mt_id': 'YOUR_LEAD_PIXEL_ID',
    'mt_adid': 'YOUR_ADVERTISER_ID',
    'mt_exem': hashedEmail,     // SHA-256 hashed email
    'v1': estimatedLeadValue,   // Estimated value
    'v2': formSubmissionId,     // Unique submission ID
    's1': formName,             // Which form was submitted
    's2': leadSource            // Lead qualification level
  });
</script>

GTM Data Layer for Event Pixels:

// Push to data layer on purchase confirmation
dataLayer.push({
  'event': 'purchase_complete',
  'transactionId': 'ORD-2024-12345',
  'transactionRevenue': 249.99,
  'transactionCurrency': 'USD',
  'itemCount': 3,
  'customerType': 'returning',
  'productCategory': 'electronics'
});

// Push to data layer on lead submission
dataLayer.push({
  'event': 'lead_submit',
  'formName': 'contact_form',
  'formSubmissionId': 'LEAD-2024-67890',
  'estimatedValue': 50.00,
  'leadQuality': 'high'
});

Step 4: Configure Enhanced Matching

Enhanced matching improves conversion attribution by sending hashed user identifiers alongside pixel fires.

// Hash email using SHA-256 before sending
async function hashEmail(email) {
  const encoder = new TextEncoder();
  const data = encoder.encode(email.toLowerCase().trim());
  const hashBuffer = await crypto.subtle.digest('SHA-256', data);
  const hashArray = Array.from(new Uint8Array(hashBuffer));
  return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
}

// Use with pixel
const hashed = await hashEmail('customer@example.com');
mtag('send', 'conversion', {
  'mt_id': 'YOUR_PIXEL_ID',
  'mt_adid': 'YOUR_ADVERTISER_ID',
  'mt_exem': hashed
});

Step 5: Set Up Dynamic Retargeting

For product-level retargeting with dynamic creative:

  1. Create a product feed in TerminalOne:

    • Navigate to Advertiser > Product Feeds
    • Upload CSV or connect API with product catalog
    • Required fields: product_id, title, image_url, price, landing_page_url
  2. Pass product data in pixels:

// On product detail pages
mtag('send', 'product_view', {
  'mt_id': 'YOUR_PIXEL_ID',
  'mt_adid': 'YOUR_ADVERTISER_ID',
  'v1': productId,      // Must match feed product_id
  'v2': productPrice,
  's1': productName,
  's2': productCategory
});
  1. Configure dynamic creative templates in TerminalOne that pull product data from the feed based on user pixel history.

Step 6: Configure Campaign Strategies in TerminalOne

Link your pixel data to campaign optimization:

  1. Navigate to Campaigns > Strategies in TerminalOne
  2. Under Strategy Settings > Goal, select:
    • Goal Type: CPA, ROAS, or CPC
    • Goal Value: Target CPA amount or ROAS multiplier
    • Pixel: Select the conversion pixel to optimize against
  3. Under Audience Targeting:
    • Add retargeting segments built from pixel data
    • Configure suppression segments (recent converters)
  4. Enable Brain Optimization for automated bid adjustments

Verification and QA

Pixel Validation Tools

Browser Developer Tools:

  1. Open Chrome DevTools > Network tab
  2. Filter for pixel.mathtag.com
  3. Navigate through your conversion funnel
  4. Verify:
    • Universal pixel fires on every page load
    • Event pixels fire only on conversion actions
    • Parameters (v1, v2, v3, s1, s2, s3) contain correct values
    • mt_id and mt_adid match your TerminalOne account
    • mt_exem contains hashed email when available

Expected Network Request Format:

https://pixel.mathtag.com/event/img?
  mt_id=YOUR_PIXEL_ID
  &mt_adid=YOUR_ADVERTISER_ID
  &mt_exem=HASHED_EMAIL
  &v1=249.99
  &v2=ORD-12345
  &v3=3
  &s1=returning
  &s2=electronics

TerminalOne Dashboard Verification

  1. In TerminalOne, navigate to Reporting > Pixel Report
  2. Set the date range to include your testing period
  3. Verify:
    • Pixel fire counts match your test actions
    • Revenue values appear correctly for sales pixels
    • No duplicate pixel fires for single conversion events
  4. Check Audience Segments to confirm member counts are growing

Common Troubleshooting

Issue Diagnosis Fix
Pixel not firing No mathtag.com requests in Network tab Check script loading, ad blocker, consent gate
Revenue shows $0 v1 parameter empty in pixel request Verify data layer variable mapping
Duplicate conversions Same transaction counted multiple times Add unique v2 (order ID) for deduplication
Audience not growing Pixel fires but segment stays at 0 Check pixel-to-segment linking in TerminalOne
Slow pixel loading High latency on mathtag.com requests Deploy async, defer non-critical pixels
Cross-domain gaps Users not tracked across domains Configure first-party cookie bridging

End-to-End Test Procedure

  1. Clear all cookies and start a fresh browser session
  2. Click a test ad (coordinate with media team for a test campaign)
  3. Browse several product pages (verify universal pixel fires on each)
  4. Add items to cart (verify add-to-cart event pixel)
  5. Complete a purchase (verify purchase pixel with revenue)
  6. Wait 2-4 hours for data to appear in TerminalOne reporting
  7. Verify the conversion attributes to the test campaign
  8. Check that audience segments update with your session data

Deployment Artifacts

  • Pixel ID inventory: Universal pixel ID and all event pixel IDs with descriptions
  • Parameter mapping: v1-v3 and s1-s3 variable definitions for each pixel
  • GTM container documentation: Tag names, triggers, variables, and version history
  • Product feed specification: Feed format, update schedule, and field mapping
  • Audience segment definitions: Segment names, pixel sources, membership durations
  • Attribution configuration: Click and impression lookback windows with rationale
  • Consent implementation: CMP integration details and pixel gating logic
  • API credentials: TerminalOne API keys for server-side integration and reporting

Linked Runbooks

Change Log and Owners

  • Document who manages TerminalOne pixel configuration and who publishes GTM tags
  • Track pixel creation and modification with dates and parameter changes
  • Record attribution window changes and their impact on reporting
  • Maintain audience segment inventory with membership durations and review dates
  • Log product feed updates and dynamic creative template changes