Integrations
Connect pxlpeak with your favorite tools and platforms for seamless data flow across your marketing stack.
Introduction
pxlpeak integrations connect your analytics data with CRMs, email platforms, ad networks, data warehouses, and business intelligence tools. Build a unified marketing stack with bidirectional data sync, real-time webhooks, and custom API connections.
Integration Architecture
How Integrations Work
pxlpeak uses a unified connector architecture for all integrations:
┌─────────────────────────────────────────────────────────────┐
│ pxlpeak Platform │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Events │ │ Leads │ │ Campaigns │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
│ │ │ │ │
│ └────────────────┼────────────────┘ │
│ │ │
│ ┌───────────▼───────────┐ │
│ │ Integration Hub │ │
│ │ • Real-time sync │ │
│ │ • Batch processing │ │
│ │ • Transform layer │ │
│ └───────────┬───────────┘ │
└──────────────────────────┼──────────────────────────────────┘
│
┌─────────────────────┼─────────────────────┐
│ │ │
▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐
│ CRMs │ │ Ads │ │ Data │
│ │ │ Networks│ │Warehouse│
└─────────┘ └─────────┘ └─────────┘Connection Types
// Integration configuration types
interface Integration {
id: string;
provider: IntegrationProvider;
status: 'active' | 'paused' | 'error';
connectionType: 'oauth' | 'api_key' | 'webhook';
config: IntegrationConfig;
syncSettings: SyncSettings;
fieldMappings: FieldMapping[];
createdAt: Date;
lastSyncAt: Date | null;
}
interface SyncSettings {
direction: 'inbound' | 'outbound' | 'bidirectional';
frequency: 'realtime' | 'hourly' | 'daily' | 'manual';
batchSize: number;
retryPolicy: RetryPolicy;
filters: SyncFilter[];
}
interface FieldMapping {
sourceField: string;
targetField: string;
transform?: TransformFunction;
required: boolean;
}CRM Integrations
Salesforce
Connect Salesforce to sync leads, contacts, accounts, and opportunities with pxlpeak attribution data.
// Connect Salesforce
const salesforce = await pxlpeak.integrations.connect({
provider: 'salesforce',
connectionType: 'oauth',
config: {
instanceUrl: 'https://yourcompany.my.salesforce.com',
apiVersion: 'v59.0',
sandbox: false
}
});
// Configure field mappings
await salesforce.configureFieldMappings([
{
sourceField: 'pxlpeak.lead.email',
targetField: 'salesforce.Lead.Email',
required: true
},
{
sourceField: 'pxlpeak.lead.firstName',
targetField: 'salesforce.Lead.FirstName',
required: false
},
{
sourceField: 'pxlpeak.attribution.firstTouchSource',
targetField: 'salesforce.Lead.First_Touch_Source__c',
required: false
},
{
sourceField: 'pxlpeak.attribution.lastTouchSource',
targetField: 'salesforce.Lead.Last_Touch_Source__c',
required: false
},
{
sourceField: 'pxlpeak.lead.score',
targetField: 'salesforce.Lead.Lead_Score__c',
transform: (score) => Math.round(score),
required: false
}
]);
// Enable bidirectional sync
await salesforce.enableSync({
direction: 'bidirectional',
frequency: 'realtime',
objects: ['Lead', 'Contact', 'Opportunity'],
syncRules: {
createNew: true,
updateExisting: true,
deleteOnRemove: false
}
});Salesforce Custom Fields
Create custom fields in Salesforce to store pxlpeak attribution data:
// Recommended Salesforce custom fields
const customFields = {
Lead: [
{ name: 'First_Touch_Source__c', type: 'Text', length: 255 },
{ name: 'First_Touch_Medium__c', type: 'Text', length: 255 },
{ name: 'First_Touch_Campaign__c', type: 'Text', length: 255 },
{ name: 'Last_Touch_Source__c', type: 'Text', length: 255 },
{ name: 'Last_Touch_Medium__c', type: 'Text', length: 255 },
{ name: 'Last_Touch_Campaign__c', type: 'Text', length: 255 },
{ name: 'Lead_Score__c', type: 'Number', precision: 3 },
{ name: 'Attribution_Revenue__c', type: 'Currency' },
{ name: 'Touchpoint_Count__c', type: 'Number', precision: 5 },
{ name: 'pxlpeak_ID__c', type: 'Text', length: 36, externalId: true }
],
Opportunity: [
{ name: 'Marketing_Attribution__c', type: 'LongTextArea' },
{ name: 'Attributed_Revenue__c', type: 'Currency' },
{ name: 'Primary_Channel__c', type: 'Picklist' }
]
};HubSpot
Native HubSpot integration for marketing automation and CRM sync:
// Connect HubSpot
const hubspot = await pxlpeak.integrations.connect({
provider: 'hubspot',
connectionType: 'oauth',
config: {
portalId: 'your-portal-id',
scopes: [
'crm.objects.contacts.read',
'crm.objects.contacts.write',
'crm.objects.deals.read',
'crm.objects.deals.write',
'marketing.lists.read',
'marketing.lists.write'
]
}
});
// Sync contacts with attribution
await hubspot.syncContacts({
direction: 'bidirectional',
frequency: 'realtime',
mappings: {
// Standard properties
email: 'email',
firstname: 'firstName',
lastname: 'lastName',
phone: 'phone',
company: 'company',
// Custom attribution properties
first_touch_source: 'attribution.firstTouch.source',
first_touch_medium: 'attribution.firstTouch.medium',
first_touch_campaign: 'attribution.firstTouch.campaign',
last_touch_source: 'attribution.lastTouch.source',
last_touch_medium: 'attribution.lastTouch.medium',
last_touch_campaign: 'attribution.lastTouch.campaign',
lead_score: 'leadScore',
lifecycle_stage: 'stage'
},
filters: [
{ field: 'leadScore', operator: 'gte', value: 20 }
]
});
// Sync deal attribution
await hubspot.syncDeals({
direction: 'bidirectional',
mappings: {
dealname: 'opportunity.name',
amount: 'opportunity.value',
closedate: 'opportunity.closeDate',
marketing_channel: 'attribution.primaryChannel',
attributed_revenue: 'attribution.revenue'
}
});HubSpot Lists Sync
Sync pxlpeak segments to HubSpot lists:
// Sync segments to HubSpot lists
await hubspot.syncSegments({
segments: [
{
pxlpeakSegmentId: 'high-value-visitors',
hubspotListId: 123456,
syncFrequency: 'hourly'
},
{
pxlpeakSegmentId: 'cart-abandoners',
hubspotListId: 123457,
syncFrequency: 'realtime'
}
]
});Pipedrive
CRM integration for sales pipeline tracking:
// Connect Pipedrive
const pipedrive = await pxlpeak.integrations.connect({
provider: 'pipedrive',
connectionType: 'api_key',
config: {
apiToken: process.env.PIPEDRIVE_API_TOKEN,
companyDomain: 'yourcompany'
}
});
// Sync persons (contacts)
await pipedrive.syncPersons({
direction: 'bidirectional',
mappings: {
name: 'fullName',
email: 'email',
phone: 'phone',
'custom_first_touch': 'attribution.firstTouch.source',
'custom_lead_score': 'leadScore'
}
});
// Sync deals with attribution
await pipedrive.syncDeals({
direction: 'outbound',
triggerOn: 'opportunity.created',
mappings: {
title: 'opportunity.name',
value: 'opportunity.value',
currency: 'opportunity.currency',
'custom_marketing_channel': 'attribution.primaryChannel',
'custom_touchpoints': 'attribution.touchpointCount'
}
});Ad Platform Integrations
Google Ads
Sync conversion data and audiences with Google Ads:
// Connect Google Ads
const googleAds = await pxlpeak.integrations.connect({
provider: 'google_ads',
connectionType: 'oauth',
config: {
customerId: '123-456-7890',
developerToken: process.env.GOOGLE_ADS_DEV_TOKEN,
loginCustomerId: '123-456-7890' // MCC account if applicable
}
});
// Upload offline conversions
await googleAds.uploadConversions({
conversionAction: 'Lead Form Submission',
conversions: [
{
gclid: 'EAIaIQobChMI...',
conversionDateTime: '2026-01-12 10:30:00-05:00',
conversionValue: 150.00,
currencyCode: 'USD'
}
]
});
// Enhanced conversions with user data
await googleAds.uploadEnhancedConversions({
conversionAction: 'Purchase',
conversions: [
{
orderId: 'ORD-12345',
conversionDateTime: '2026-01-12 14:00:00-05:00',
conversionValue: 299.00,
currencyCode: 'USD',
userIdentifiers: {
hashedEmail: 'sha256_hash_of_email',
hashedPhoneNumber: 'sha256_hash_of_phone'
}
}
]
});
// Sync Customer Match audiences
await googleAds.syncAudiences({
audiences: [
{
pxlpeakSegmentId: 'high-value-customers',
googleAudienceId: '123456789',
syncFrequency: 'daily',
identifiers: ['email', 'phone']
},
{
pxlpeakSegmentId: 'cart-abandoners-30d',
googleAudienceId: '987654321',
syncFrequency: 'hourly',
identifiers: ['email']
}
]
});GCLID Capture
Automatically capture Google Click IDs for conversion tracking:
// Automatic GCLID capture (enabled by default)
pxlpeak.init({
apiKey: 'pk_live_...',
gclidCapture: {
enabled: true,
cookieName: '_gcl_aw',
cookieDuration: 90, // days
parameterName: 'gclid'
}
});
// Access captured GCLID
const gclid = pxlpeak.getGclid();
// Include in conversion tracking
pxlpeak.track('purchase', {
revenue: 299.00,
orderId: 'ORD-12345',
gclid: gclid // Automatically included if captured
});Meta Ads (Facebook/Instagram)
Connect Meta Ads for conversion API and audience sync:
// Connect Meta Ads
const metaAds = await pxlpeak.integrations.connect({
provider: 'meta_ads',
connectionType: 'oauth',
config: {
accessToken: process.env.META_ACCESS_TOKEN,
pixelId: '123456789012345',
adAccountId: 'act_123456789'
}
});
// Send Conversions API events
await metaAds.sendConversion({
eventName: 'Purchase',
eventTime: Math.floor(Date.now() / 1000),
userData: {
em: ['sha256_email_hash'],
ph: ['sha256_phone_hash'],
fn: ['sha256_firstname_hash'],
ln: ['sha256_lastname_hash'],
ct: ['sha256_city_hash'],
st: ['sha256_state_hash'],
zp: ['sha256_zip_hash'],
country: ['sha256_country_hash'],
external_id: ['user_123'],
client_ip_address: '192.168.1.1',
client_user_agent: 'Mozilla/5.0...',
fbc: 'fb.1.1554763741205.AbCdEfGhIjKl', // Facebook click ID
fbp: 'fb.1.1558571054389.1098115397' // Facebook browser ID
},
customData: {
currency: 'USD',
value: 299.00,
content_ids: ['SKU-123', 'SKU-456'],
content_type: 'product',
order_id: 'ORD-12345'
},
eventSourceUrl: 'https://example.com/checkout/success',
actionSource: 'website'
});
// Sync Custom Audiences
await metaAds.syncAudiences({
audiences: [
{
pxlpeakSegmentId: 'high-ltv-customers',
metaAudienceId: '23847238472',
syncFrequency: 'daily',
dataSource: {
type: 'customer_file',
identifiers: ['email', 'phone', 'firstName', 'lastName']
}
}
]
});
// Create Lookalike Audience from segment
await metaAds.createLookalikeAudience({
sourceSegmentId: 'top-converters',
name: 'Lookalike - Top Converters',
countries: ['US', 'CA'],
ratio: 0.01 // Top 1%
});LinkedIn Ads
B2B advertising integration:
// Connect LinkedIn Ads
const linkedinAds = await pxlpeak.integrations.connect({
provider: 'linkedin_ads',
connectionType: 'oauth',
config: {
adAccountId: '123456789'
}
});
// Upload offline conversions
await linkedinAds.uploadConversions({
conversionRule: 'Demo Request',
conversions: [
{
conversionHappenedAt: Date.now(),
conversionValue: {
currencyCode: 'USD',
amount: '500.00'
},
user: {
userIds: [
{ idType: 'SHA256_EMAIL', idValue: 'sha256_hash' }
],
userInfo: {
firstName: 'John',
lastName: 'Doe',
companyName: 'Acme Corp',
title: 'Marketing Director'
}
}
}
]
});
// Sync Matched Audiences
await linkedinAds.syncAudiences({
audiences: [
{
pxlpeakSegmentId: 'enterprise-leads',
linkedinAudienceId: 'urn:li:userGeneratedContent:123',
syncFrequency: 'daily',
matchType: 'company' // or 'contact'
}
]
});TikTok Ads
Connect TikTok for events API and audience sync:
// Connect TikTok Ads
const tiktokAds = await pxlpeak.integrations.connect({
provider: 'tiktok_ads',
connectionType: 'api_key',
config: {
accessToken: process.env.TIKTOK_ACCESS_TOKEN,
pixelCode: 'PIXEL123456',
advertiserIds: ['7123456789012345678']
}
});
// Send Events API conversion
await tiktokAds.sendEvent({
eventName: 'CompletePayment',
eventTime: Math.floor(Date.now() / 1000),
user: {
email: 'sha256_email_hash',
phone: 'sha256_phone_hash',
external_id: 'user_123',
ttclid: 'E.C.P.abc123...' // TikTok Click ID
},
properties: {
currency: 'USD',
value: 149.00,
content_id: 'SKU-789',
content_type: 'product',
content_name: 'Premium Plan'
},
page: {
url: 'https://example.com/checkout/success',
referrer: 'https://www.tiktok.com/'
}
});
// Sync Custom Audiences
await tiktokAds.syncAudiences({
audiences: [
{
pxlpeakSegmentId: 'recent-purchasers',
tiktokAudienceId: '7123456789',
syncFrequency: 'daily'
}
]
});Email Marketing Integrations
Mailchimp
Sync contacts and segment data with Mailchimp:
// Connect Mailchimp
const mailchimp = await pxlpeak.integrations.connect({
provider: 'mailchimp',
connectionType: 'oauth',
config: {
server: 'us1', // Your Mailchimp server prefix
audienceId: 'abc123def4' // Your list ID
}
});
// Sync contacts with merge fields
await mailchimp.syncContacts({
direction: 'bidirectional',
frequency: 'realtime',
mappings: {
email_address: 'email',
merge_fields: {
FNAME: 'firstName',
LNAME: 'lastName',
COMPANY: 'company',
LEADSCORE: 'leadScore',
FIRSTTOUCH: 'attribution.firstTouch.source',
LASTTOUCH: 'attribution.lastTouch.source'
},
tags: {
source: 'segments' // Sync pxlpeak segments as Mailchimp tags
}
}
});
// Sync segments to Mailchimp tags
await mailchimp.syncSegments({
segments: [
{ pxlpeakSegmentId: 'high-engagement', mailchimpTag: 'High Engagement' },
{ pxlpeakSegmentId: 'at-risk', mailchimpTag: 'At Risk' },
{ pxlpeakSegmentId: 'power-users', mailchimpTag: 'Power Users' }
],
syncFrequency: 'hourly'
});
// Track email campaign performance
await mailchimp.enableCampaignTracking({
trackOpens: true,
trackClicks: true,
utmParams: {
source: 'mailchimp',
medium: 'email'
}
});Klaviyo
E-commerce email integration:
// Connect Klaviyo
const klaviyo = await pxlpeak.integrations.connect({
provider: 'klaviyo',
connectionType: 'api_key',
config: {
publicApiKey: process.env.KLAVIYO_PUBLIC_KEY,
privateApiKey: process.env.KLAVIYO_PRIVATE_KEY
}
});
// Sync profiles with custom properties
await klaviyo.syncProfiles({
direction: 'bidirectional',
frequency: 'realtime',
mappings: {
email: 'email',
first_name: 'firstName',
last_name: 'lastName',
phone_number: 'phone',
properties: {
lead_score: 'leadScore',
first_touch_source: 'attribution.firstTouch.source',
first_touch_campaign: 'attribution.firstTouch.campaign',
last_touch_source: 'attribution.lastTouch.source',
last_purchase_date: 'lastPurchaseDate',
total_spent: 'totalRevenue',
purchase_count: 'purchaseCount'
}
}
});
// Sync events to Klaviyo
await klaviyo.syncEvents({
events: [
{ pxlpeakEvent: 'product_viewed', klaviyoMetric: 'Viewed Product' },
{ pxlpeakEvent: 'add_to_cart', klaviyoMetric: 'Added to Cart' },
{ pxlpeakEvent: 'checkout_started', klaviyoMetric: 'Started Checkout' },
{ pxlpeakEvent: 'purchase', klaviyoMetric: 'Placed Order' }
]
});
// Sync segments to Klaviyo lists
await klaviyo.syncSegmentsToLists({
segments: [
{ pxlpeakSegmentId: 'vip-customers', klaviyoListId: 'Abc123' },
{ pxlpeakSegmentId: 'win-back', klaviyoListId: 'Def456' }
]
});ActiveCampaign
Marketing automation integration:
// Connect ActiveCampaign
const activeCampaign = await pxlpeak.integrations.connect({
provider: 'activecampaign',
connectionType: 'api_key',
config: {
accountName: 'yourcompany',
apiKey: process.env.ACTIVECAMPAIGN_API_KEY
}
});
// Sync contacts with custom fields
await activeCampaign.syncContacts({
direction: 'bidirectional',
frequency: 'realtime',
mappings: {
email: 'email',
firstName: 'firstName',
lastName: 'lastName',
phone: 'phone',
customFields: {
'Lead Score': 'leadScore',
'First Touch Source': 'attribution.firstTouch.source',
'Attribution Revenue': 'attributedRevenue'
}
}
});
// Trigger automations based on pxlpeak events
await activeCampaign.setupAutomationTriggers({
triggers: [
{
pxlpeakEvent: 'high_intent_score',
automationId: 123,
condition: { leadScore: { gte: 80 } }
},
{
pxlpeakEvent: 'cart_abandonment',
automationId: 456,
delay: '30m'
}
]
});Data Warehouse Integrations
Google BigQuery
Export analytics data to BigQuery for advanced analysis:
// Connect BigQuery
const bigquery = await pxlpeak.integrations.connect({
provider: 'bigquery',
connectionType: 'service_account',
config: {
projectId: 'your-gcp-project',
datasetId: 'pxlpeak_data',
credentials: JSON.parse(process.env.GOOGLE_CREDENTIALS)
}
});
// Configure data export
await bigquery.configureExport({
tables: [
{
name: 'events',
schema: 'events',
partitionField: 'timestamp',
partitionType: 'DAY',
clusteringFields: ['event_name', 'user_id']
},
{
name: 'sessions',
schema: 'sessions',
partitionField: 'session_start',
partitionType: 'DAY'
},
{
name: 'users',
schema: 'users',
updateMode: 'merge'
},
{
name: 'attribution',
schema: 'attribution',
partitionField: 'conversion_timestamp',
partitionType: 'DAY'
}
],
exportFrequency: 'hourly',
backfillHistory: 90 // days
});
// Schedule custom queries
await bigquery.scheduleQuery({
name: 'daily_channel_performance',
query: `
SELECT
DATE(timestamp) as date,
attribution.channel as channel,
COUNT(DISTINCT user_id) as users,
COUNT(*) as conversions,
SUM(revenue) as revenue
FROM \`pxlpeak_data.events\`
WHERE event_name = 'purchase'
AND DATE(timestamp) = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
GROUP BY date, channel
`,
schedule: '0 6 * * *', // Daily at 6 AM
destinationTable: 'channel_performance_daily'
});Snowflake
Enterprise data warehouse integration:
// Connect Snowflake
const snowflake = await pxlpeak.integrations.connect({
provider: 'snowflake',
connectionType: 'key_pair',
config: {
account: 'abc12345.us-east-1',
username: 'PXLPEAK_SERVICE',
privateKey: process.env.SNOWFLAKE_PRIVATE_KEY,
warehouse: 'ANALYTICS_WH',
database: 'MARKETING_DATA',
schema: 'PXLPEAK'
}
});
// Configure streaming export
await snowflake.configureExport({
mode: 'streaming', // Real-time using Snowpipe
tables: [
{
name: 'RAW_EVENTS',
format: 'JSON',
fileFormat: 'PXLPEAK_JSON_FORMAT'
},
{
name: 'SESSIONS',
format: 'PARQUET'
},
{
name: 'ATTRIBUTION',
format: 'PARQUET'
}
],
stage: 'PXLPEAK_STAGE',
notificationChannel: 'PXLPEAK_NOTIFICATIONS'
});
// Create secure data share
await snowflake.createDataShare({
shareName: 'PXLPEAK_ANALYTICS',
tables: ['EVENTS', 'SESSIONS', 'ATTRIBUTION', 'USERS'],
consumers: ['org_partner_account']
});Amazon Redshift
AWS data warehouse integration:
// Connect Redshift
const redshift = await pxlpeak.integrations.connect({
provider: 'redshift',
connectionType: 'iam',
config: {
clusterIdentifier: 'analytics-cluster',
database: 'marketing',
dbUser: 'pxlpeak_service',
region: 'us-east-1',
iamRole: 'arn:aws:iam::123456789012:role/PxlpeakRedshiftRole'
}
});
// Configure S3 staging and COPY
await redshift.configureExport({
s3Bucket: 'pxlpeak-data-staging',
s3Prefix: 'redshift-export/',
tables: [
{ name: 'events', sortKey: 'timestamp', distKey: 'user_id' },
{ name: 'sessions', sortKey: 'session_start', distKey: 'user_id' },
{ name: 'attribution', sortKey: 'conversion_time' }
],
exportFrequency: 'hourly',
compression: 'GZIP',
fileFormat: 'PARQUET'
});Business Intelligence Integrations
Looker
Connect Looker for data exploration and dashboards:
// Connect Looker
const looker = await pxlpeak.integrations.connect({
provider: 'looker',
connectionType: 'api_key',
config: {
baseUrl: 'https://yourcompany.looker.com',
clientId: process.env.LOOKER_CLIENT_ID,
clientSecret: process.env.LOOKER_CLIENT_SECRET
}
});
// Generate LookML model
await looker.generateLookML({
modelName: 'pxlpeak_analytics',
explores: [
{
name: 'events',
joins: ['sessions', 'users', 'attribution']
},
{
name: 'attribution',
joins: ['campaigns', 'channels']
}
],
outputPath: './looker/models/pxlpeak.model.lkml'
});
// Push dashboard templates
await looker.deployDashboards({
dashboards: [
'marketing_overview',
'attribution_analysis',
'channel_performance',
'conversion_funnels'
],
folder: 'pxlpeak_analytics'
});Tableau
Tableau Desktop and Server integration:
// Connect Tableau
const tableau = await pxlpeak.integrations.connect({
provider: 'tableau',
connectionType: 'pat', // Personal Access Token
config: {
serverUrl: 'https://tableau.yourcompany.com',
siteName: 'marketing',
tokenName: 'pxlpeak_integration',
tokenValue: process.env.TABLEAU_PAT
}
});
// Publish data source
await tableau.publishDataSource({
name: 'pxlpeak_events',
project: 'Marketing Analytics',
refreshSchedule: 'hourly',
connection: {
type: 'bigquery', // Use BigQuery as intermediary
project: 'your-gcp-project',
dataset: 'pxlpeak_data'
}
});
// Deploy workbook templates
await tableau.publishWorkbook({
name: 'Marketing Attribution Dashboard',
project: 'Marketing Analytics',
workbookPath: './tableau/attribution_dashboard.twbx',
dataSources: ['pxlpeak_events', 'pxlpeak_attribution']
});Microsoft Power BI
Power BI integration for Microsoft ecosystem:
// Connect Power BI
const powerbi = await pxlpeak.integrations.connect({
provider: 'powerbi',
connectionType: 'service_principal',
config: {
tenantId: process.env.AZURE_TENANT_ID,
clientId: process.env.POWERBI_CLIENT_ID,
clientSecret: process.env.POWERBI_CLIENT_SECRET,
workspaceId: 'abc123-def456-...'
}
});
// Create streaming dataset
await powerbi.createStreamingDataset({
name: 'pxlpeak_realtime',
tables: [
{
name: 'events',
columns: [
{ name: 'timestamp', type: 'DateTime' },
{ name: 'event_name', type: 'String' },
{ name: 'user_id', type: 'String' },
{ name: 'properties', type: 'String' },
{ name: 'revenue', type: 'Number' }
]
}
],
defaultMode: 'PushStreaming'
});
// Push real-time events
pxlpeak.on('event', async (event) => {
await powerbi.pushRows('pxlpeak_realtime', 'events', [
{
timestamp: event.timestamp,
event_name: event.name,
user_id: event.userId,
properties: JSON.stringify(event.properties),
revenue: event.revenue || 0
}
]);
});Webhook Integrations
Configuring Webhooks
Send real-time event data to any endpoint:
// Create webhook
const webhook = await pxlpeak.webhooks.create({
name: 'Lead Notifications',
url: 'https://api.yourcompany.com/webhooks/pxlpeak',
events: ['lead.created', 'lead.qualified', 'lead.converted'],
secret: process.env.WEBHOOK_SECRET,
headers: {
'X-Custom-Header': 'value'
},
retryPolicy: {
maxRetries: 5,
backoff: 'exponential',
initialDelay: 1000
}
});
// Webhook payload structure
interface WebhookPayload {
id: string;
event: string;
timestamp: string;
data: Record<string, unknown>;
signature: string;
}
// Example payload
{
"id": "evt_abc123",
"event": "lead.qualified",
"timestamp": "2026-01-12T14:30:00Z",
"data": {
"leadId": "lead_xyz789",
"email": "john@example.com",
"score": 85,
"attribution": {
"firstTouch": { "source": "google", "medium": "cpc" },
"lastTouch": { "source": "direct", "medium": "none" }
}
},
"signature": "sha256=abc123..."
}Verifying Webhook Signatures
// Server-side webhook verification
import crypto from 'crypto';
function verifyWebhookSignature(
payload: string,
signature: string,
secret: string
): boolean {
const expectedSignature = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(`sha256=${expectedSignature}`)
);
}
// Express middleware example
app.post('/webhooks/pxlpeak', (req, res) => {
const signature = req.headers['x-pxlpeak-signature'];
const payload = JSON.stringify(req.body);
if (!verifyWebhookSignature(payload, signature, process.env.WEBHOOK_SECRET)) {
return res.status(401).json({ error: 'Invalid signature' });
}
// Process webhook
const { event, data } = req.body;
switch (event) {
case 'lead.qualified':
handleQualifiedLead(data);
break;
case 'lead.converted':
handleConversion(data);
break;
}
res.status(200).json({ received: true });
});Available Webhook Events
| Event | Description | Payload Data |
|-------|-------------|--------------|
| event.tracked | Any event is tracked | Full event data |
| lead.created | New lead identified | Lead profile + attribution |
| lead.updated | Lead properties updated | Updated fields |
| lead.qualified | Lead reaches score threshold | Score + qualification data |
| lead.converted | Lead converts to customer | Conversion details |
| session.started | New session begins | Session metadata |
| session.ended | Session ends | Session summary |
| goal.completed | Goal is achieved | Goal details + attribution |
| segment.entered | User enters segment | User + segment info |
| segment.exited | User exits segment | User + segment info |
Custom API Connections
REST API Integration
Connect any REST API using the custom connector:
// Create custom REST integration
const customApi = await pxlpeak.integrations.createCustom({
name: 'Internal CRM',
type: 'rest',
config: {
baseUrl: 'https://api.internal-crm.com/v1',
authentication: {
type: 'bearer',
token: process.env.INTERNAL_CRM_TOKEN
},
rateLimits: {
requestsPerSecond: 10,
burstLimit: 50
}
}
});
// Define sync operations
await customApi.defineSyncOperation({
name: 'sync_contacts',
direction: 'outbound',
endpoint: '/contacts',
method: 'POST',
mapping: {
request: {
email: '$.lead.email',
name: '$.lead.fullName',
source: '$.attribution.firstTouch.source',
score: '$.leadScore'
}
},
trigger: {
event: 'lead.created',
condition: { leadScore: { gte: 30 } }
}
});
// Define fetch operations for bidirectional sync
await customApi.defineFetchOperation({
name: 'fetch_contact_status',
endpoint: '/contacts/{email}/status',
method: 'GET',
schedule: 'hourly',
mapping: {
response: {
'crmStatus': '$.status',
'crmLastContact': '$.lastContactDate'
}
}
});GraphQL Integration
// Create GraphQL integration
const graphqlApi = await pxlpeak.integrations.createCustom({
name: 'Internal GraphQL API',
type: 'graphql',
config: {
endpoint: 'https://api.yourcompany.com/graphql',
authentication: {
type: 'header',
headerName: 'Authorization',
headerValue: `Bearer ${process.env.GRAPHQL_TOKEN}`
}
}
});
// Define mutation for lead sync
await graphqlApi.defineMutation({
name: 'create_crm_lead',
mutation: `
mutation CreateLead($input: LeadInput!) {
createLead(input: $input) {
id
email
status
}
}
`,
variables: {
input: {
email: '$.lead.email',
firstName: '$.lead.firstName',
lastName: '$.lead.lastName',
source: '$.attribution.firstTouch.source',
score: '$.leadScore'
}
},
trigger: {
event: 'lead.qualified'
}
});
// Define query for data enrichment
await graphqlApi.defineQuery({
name: 'enrich_company_data',
query: `
query GetCompanyData($domain: String!) {
company(domain: $domain) {
name
industry
employeeCount
revenue
technologies
}
}
`,
variables: {
domain: '$.lead.companyDomain'
},
schedule: 'on_lead_create'
});Integration Management
Monitoring Integration Health
// Get integration status
const status = await pxlpeak.integrations.getStatus('salesforce_123');
// Returns:
{
id: 'salesforce_123',
provider: 'salesforce',
status: 'active',
lastSyncAt: '2026-01-12T14:30:00Z',
syncStats: {
totalSynced: 15420,
lastHour: 145,
errors: 3,
errorRate: 0.02
},
health: {
score: 98,
issues: [
{
type: 'field_mapping',
message: 'Custom field "Industry__c" not found in Salesforce',
severity: 'warning'
}
]
}
}
// List all integrations
const integrations = await pxlpeak.integrations.list({
status: 'active',
provider: 'crm' // Filter by category
});
// Get sync logs
const logs = await pxlpeak.integrations.getSyncLogs('salesforce_123', {
startDate: '2026-01-01',
endDate: '2026-01-12',
status: 'error'
});Error Handling and Retry
// Configure error handling
await pxlpeak.integrations.configureErrorHandling('hubspot_456', {
onError: {
notify: ['admin@yourcompany.com'],
slack: '#integration-alerts',
pauseAfterConsecutiveErrors: 10
},
retryPolicy: {
maxRetries: 5,
backoffType: 'exponential',
initialDelayMs: 1000,
maxDelayMs: 300000,
retryableErrors: [
'RATE_LIMITED',
'TIMEOUT',
'SERVICE_UNAVAILABLE'
]
},
deadLetterQueue: {
enabled: true,
retentionDays: 30
}
});
// Manually retry failed syncs
await pxlpeak.integrations.retryFailed('salesforce_123', {
fromDate: '2026-01-10',
toDate: '2026-01-12'
});Pausing and Resuming
// Pause integration
await pxlpeak.integrations.pause('salesforce_123', {
reason: 'Salesforce maintenance window'
});
// Resume integration
await pxlpeak.integrations.resume('salesforce_123');
// Schedule maintenance window
await pxlpeak.integrations.scheduleMaintenanceWindow('salesforce_123', {
startTime: '2026-01-15T02:00:00Z',
endTime: '2026-01-15T06:00:00Z',
recurring: 'weekly'
});Integration Security
Credential Management
// Rotate API credentials
await pxlpeak.integrations.rotateCredentials('hubspot_456', {
newCredentials: {
accessToken: process.env.NEW_HUBSPOT_TOKEN
},
validateBeforeRotation: true
});
// View credential usage
const usage = await pxlpeak.integrations.getCredentialUsage('salesforce_123');
// Returns:
{
lastUsed: '2026-01-12T14:30:00Z',
totalApiCalls: 145000,
rateLimitRemaining: 8500,
rateLimitResetAt: '2026-01-12T15:00:00Z'
}Data Privacy Controls
// Configure data privacy for integration
await pxlpeak.integrations.configurePrivacy('salesforce_123', {
piiHandling: {
hashEmails: true,
hashPhones: true,
excludeFields: ['ssn', 'creditCard', 'password']
},
dataResidency: {
region: 'us-east-1',
backupRegion: 'us-west-2'
},
retention: {
syncLogs: 90, // days
errorLogs: 365,
rawData: 30
},
consent: {
requireOptIn: true,
honorDoNotTrack: true,
gdprCompliant: true
}
});Available Integrations
By Category
| Category | Integrations | |----------|--------------| | CRM | Salesforce, HubSpot, Pipedrive, Zoho CRM, Microsoft Dynamics, Freshsales | | Ad Platforms | Google Ads, Meta Ads, LinkedIn Ads, TikTok Ads, Twitter Ads, Pinterest Ads, Snapchat Ads | | Email Marketing | Mailchimp, Klaviyo, ActiveCampaign, Brevo (Sendinblue), ConvertKit, Drip | | Marketing Automation | Marketo, Pardot, Eloqua, Act-On | | Data Warehouses | BigQuery, Snowflake, Redshift, Databricks | | BI Tools | Looker, Tableau, Power BI, Metabase, Mode | | Customer Data Platforms | Segment, mParticle, Rudderstack, Tealium | | Communication | Slack, Microsoft Teams, Discord | | E-commerce | Shopify, WooCommerce, Magento, BigCommerce | | Support | Zendesk, Intercom, Freshdesk, Help Scout |