Delivery Options
Outbrain offers multiple methods for deploying tracking pixels, each suited to different technical environments and organizational needs:
- Direct JavaScript embed: Paste pixel code directly into site templates
- Google Tag Manager: Deploy and manage Outbrain Pixel through GTM
- Server-Side Conversion API: Send conversion data from your backend
- Hybrid approach: Combine browser pixel with server-side tracking for redundancy
Option 1: Direct JavaScript Embed
When to Use
- Simple websites with limited tracking requirements
- Teams with direct access to site templates or header/footer files
- Quick implementation needed without tag management overhead
- Static sites or CMS platforms with custom code injection
Implementation Steps
Step 1: Obtain Pixel Code from Amplify
- Log in to Outbrain Amplify dashboard
- Navigate to Tracking & Conversions or Pixel Setup
- Copy the base pixel JavaScript snippet
- Note your unique Outbrain Pixel ID (typically in format:
OB-XXXXX-X)
Step 2: Install Base Pixel on All Pages
The base pixel should fire on every page to enable audience building and retargeting.
<!-- Outbrain Base Pixel - Place in <head> or before </body> -->
<script type="text/javascript">
!function(_window, _document) {
var OB_ADV_ID = 'YOUR_PIXEL_ID_HERE';
if (_window.obApi) {
var toArray = function(object) {
return Object.prototype.toString.call(object) === '[object Array]' ? object : [object];
};
_window.obApi.marketerId = toArray(_window.obApi.marketerId).concat(toArray(OB_ADV_ID));
return;
}
var api = _window.obApi = function() {
api.dispatch ? api.dispatch.apply(api, arguments) : api.queue.push(arguments);
};
api.version = '1.1';
api.loaded = true;
api.marketerId = OB_ADV_ID;
api.queue = [];
var tag = _document.createElement('script');
tag.async = true;
tag.src = '//amplify.outbrain.com/cp/obtp.js';
tag.type = 'text/javascript';
var script = _document.getElementsByTagName('script')[0];
script.parentNode.insertBefore(tag, script);
}(window, document);
obApi('track', 'PAGE_VIEW');
</script>
Key Configuration:
- Replace
YOUR_PIXEL_ID_HEREwith your actual Outbrain Pixel ID - Place in site template so it loads on all pages
- Ensure it fires before the closing
</body>tag or in the<head>section
Step 3: Add Conversion Pixel to Post-Conversion Pages
On pages where conversions happen (thank-you pages, order confirmations, lead form success pages), add the conversion tracking pixel.
<!-- Outbrain Conversion Pixel - Place on conversion pages only -->
<script type="text/javascript">
obApi('track', 'Conversion', {
orderValue: 99.99, // Total purchase value or lead value
orderId: 'ORDER-12345', // Unique transaction ID
currency: 'USD' // Currency code
});
</script>
Dynamic Values: Replace static values with server-side variables:
<!-- Example with server-side template variables -->
<script type="text/javascript">
obApi('track', 'Conversion', {
orderValue: {{ order.total }},
orderId: '{{ order.id }}',
currency: '{{ order.currency }}'
});
</script>
Validation
- Load a page with the base pixel installed
- Open browser developer tools (F12) > Network tab
- Look for requests to
amplify.outbrain.comoroutbrain.com - Verify request includes your Pixel ID and PAGE_VIEW event
- Trigger a test conversion and verify Conversion event fires with correct parameters
Option 2: Google Tag Manager Deployment
When to Use
- Marketing teams need to update tracking without developer involvement
- Multiple tracking pixels and tags are already managed in GTM
- Need flexibility to test and modify tracking logic quickly
- Want to use GTM's built-in debugging and preview tools
Implementation Steps
Step 1: Create Outbrain Base Pixel Tag
- Log in to Google Tag Manager
- Navigate to Tags > New
- Click Tag Configuration > Custom HTML
- Name the tag:
Outbrain - Base Pixel - Paste the Outbrain base pixel code (same as direct embed option)
- Set trigger to All Pages (or Initialization - All Pages for immediate firing)
- Save the tag
Step 2: Create Conversion Tracking Tag
- Create a new Custom HTML tag in GTM
- Name it:
Outbrain - Conversion Tracking - Paste the conversion pixel code
- Use GTM variables to dynamically populate conversion parameters:
<script type="text/javascript">
obApi('track', 'Conversion', {
orderValue: {{DLV - Order Value}}, // GTM Data Layer Variable
orderId: '{{DLV - Order ID}}', // GTM Data Layer Variable
currency: '{{DLV - Currency}}' // GTM Data Layer Variable
});
</script>
- Set trigger based on conversion event (e.g., Custom Event with event name
purchaseor Page View on/thank-youURL) - Save the tag
Step 3: Configure Data Layer Variables
If using dynamic values, create GTM Data Layer Variables:
- Go to Variables > New > Data Layer Variable
- Create variables for:
DLV - Order Value→ Data Layer Variable Name:ecommerce.purchase.actionField.revenueDLV - Order ID→ Data Layer Variable Name:ecommerce.purchase.actionField.transaction_idDLV - Currency→ Data Layer Variable Name:ecommerce.currencyCode
- Adjust variable paths to match your site's data layer structure
Step 4: Test in Preview Mode
- Click Preview in GTM to enter debug mode
- Navigate to your site in the opened browser window
- Verify Outbrain - Base Pixel tag fires on all pages
- Navigate to conversion page or trigger conversion event
- Verify Outbrain - Conversion Tracking tag fires with correct parameters
- Check the Variables tab to ensure dynamic values are populated
Step 5: Publish GTM Container
- Exit preview mode
- Click Submit in GTM
- Add version name and description (e.g., "Add Outbrain conversion tracking")
- Click Publish
- Monitor live site to confirm tags fire correctly in production
Advanced GTM Configuration
Trigger Exceptions: Prevent pixel from firing if user has opted out of tracking:
- Create a custom JavaScript variable to check consent status
- Add exception trigger to Outbrain tags: Fire tag except when consent variable is false
Custom Event Tracking: Track engagement actions beyond conversions:
<script type="text/javascript">
obApi('track', 'CustomEvent', {
eventName: '{{DLV - Event Name}}',
eventValue: {{DLV - Event Value}}
});
</script>
Option 3: Server-Side Conversion API
When to Use
- Privacy regulations require minimizing client-side tracking
- Ad blockers or browser restrictions are blocking pixel fires
- Need more reliable conversion tracking independent of cookies
- Want to send offline or CRM conversions to Outbrain
Prerequisites
- Backend server with ability to make HTTPS POST requests
- Outbrain API credentials (contact Outbrain support to obtain)
- User identifier to match conversions to clicks (email, phone, or Outbrain click ID)
Implementation Steps
Step 1: Obtain API Credentials
- Contact Outbrain support or account manager
- Request access to Conversion API
- Receive API endpoint URL and authentication token
- Store credentials securely (environment variables, secret manager)
Step 2: Capture Click ID from Outbrain Campaigns
Outbrain appends a click ID parameter (obOrigUrl or custom parameter) to landing page URLs. Capture and store this on the user's session or cookie.
// Client-side: Capture Outbrain click ID from URL
const urlParams = new URLSearchParams(window.location.search);
const obClickId = urlParams.get('ob_click_id');
if (obClickId) {
sessionStorage.setItem('ob_click_id', obClickId);
}
Step 3: Send Conversion Data from Backend
When a conversion occurs on your server (e.g., order placed, lead form submitted), make a POST request to Outbrain's Conversion API.
Example: Node.js
const axios = require('axios');
async function sendOutbrainConversion(orderData) {
const obClickId = orderData.obClickId; // Retrieved from session
const conversionPayload = {
click_id: obClickId,
conversion_timestamp: new Date().toISOString(),
conversion_value: orderData.revenue,
transaction_id: orderData.orderId,
currency: orderData.currency,
hashed_email: hashEmail(orderData.customerEmail) // Optional: for enhanced matching
};
try {
const response = await axios.post(
'https://api.outbrain.com/amplify/v1/conversions',
conversionPayload,
{
headers: {
'Authorization': `Bearer ${process.env.OUTBRAIN_API_TOKEN}`,
'Content-Type': 'application/json'
}
}
);
console.log('Outbrain conversion sent:', response.data);
} catch (error) {
console.error('Outbrain conversion error:', error.response.data);
}
}
function hashEmail(email) {
const crypto = require('crypto');
return crypto.createHash('sha256').update(email.toLowerCase().trim()).digest('hex');
}
Example: Python
import requests
import hashlib
import os
from datetime import datetime
def send_outbrain_conversion(order_data):
ob_click_id = order_data.get('ob_click_id')
payload = {
'click_id': ob_click_id,
'conversion_timestamp': datetime.utcnow().isoformat(),
'conversion_value': order_data['revenue'],
'transaction_id': order_data['order_id'],
'currency': order_data['currency'],
'hashed_email': hash_email(order_data['customer_email'])
}
headers = {
'Authorization': f"Bearer {os.environ['OUTBRAIN_API_TOKEN']}",
'Content-Type': 'application/json'
}
response = requests.post(
'https://api.outbrain.com/amplify/v1/conversions',
json=payload,
headers=headers
)
if response.status_code == 200:
print('Outbrain conversion sent successfully')
else:
print(f'Error: {response.status_code} - {response.text}')
def hash_email(email):
return hashlib.sha256(email.lower().strip().encode()).hexdigest()
Step 4: Validate API Integration
- Send a test conversion using a known Outbrain click ID
- Check API response for success confirmation (HTTP 200)
- Verify conversion appears in Amplify dashboard within 1-2 hours
- Monitor server logs for any API errors or rate limiting
Enhanced Matching with Hashed PII
For improved attribution accuracy, send hashed personally identifiable information:
- Hashed email: SHA-256 hash of lowercase, trimmed email
- Hashed phone: SHA-256 hash of phone number (E.164 format)
- User IP address: For geo-matching and fraud prevention
Privacy Considerations:
- Hash PII before sending (never send plaintext emails or phone numbers)
- Ensure compliance with GDPR, CCPA, and other privacy regulations
- Include hashed PII only with explicit user consent
Hybrid Approach: Browser Pixel + Server-Side API
Benefits of Redundancy
- Browser pixel tracks most conversions in real-time
- Server-side API catches conversions blocked by ad blockers or privacy tools
- Enhanced matching improves attribution accuracy
- Offline conversions (phone orders, in-store sales) can be uploaded via API
Implementation Strategy
- Deploy browser-based pixel (direct embed or GTM) for immediate tracking
- Implement server-side Conversion API for critical conversions
- Use unique transaction IDs to deduplicate conversions in reporting
- Monitor both channels to identify discrepancies and coverage gaps
Validation Checklist
- Base pixel fires on all site pages
- Pixel ID is correct and matches Amplify account
- Conversion pixel fires on post-conversion pages only
- Conversion parameters (value, order ID, currency) are dynamic and accurate
- No JavaScript errors in browser console blocking pixel execution
- GTM container published (if using Tag Manager)
- Server-side API authenticated and returning HTTP 200 responses
- Test conversions appear in Amplify dashboard within 1-2 hours
- Cross-domain tracking enabled if campaigns drive to multiple domains
- Consent management integration respects user opt-outs
Troubleshooting
Pixel Not Firing
- Check browser developer tools Network tab for requests to
outbrain.comoramplify.outbrain.com - Verify JavaScript is enabled and no ad blockers are interfering
- Ensure pixel code is in
<head>or before</body>closing tag - Test in incognito/private browsing mode to rule out browser extensions
Conversions Not Tracking
- Confirm conversion pixel is on the post-conversion page (not just landing page)
- Verify conversion parameters are populated (not null or undefined)
- Check that Outbrain click ID is preserved through conversion funnel
- Review attribution window in Amplify (conversions outside window won't attribute)
GTM Tag Not Firing
- Enter GTM Preview mode and verify tag appears in Tags Fired section
- Check trigger conditions match expected page or event
- Ensure data layer variables are available when tag fires
- Publish GTM container (tags in preview mode don't fire in production)
API Integration Errors
- Verify API token is valid and has not expired
- Check request payload matches required schema
- Monitor for rate limiting (HTTP 429 errors)
- Ensure HTTPS is used (HTTP requests will fail)