Skip to content

Instantly share code, notes, and snippets.

@btg5679
Last active November 12, 2025 12:37
Show Gist options
  • Select an option

  • Save btg5679/b4f2e9cfa0b898cfe2aa9a91beec78cd to your computer and use it in GitHub Desktop.

Select an option

Save btg5679/b4f2e9cfa0b898cfe2aa9a91beec78cd to your computer and use it in GitHub Desktop.
Partners Advertising Event
// SAMPLE Event Contract
interface CampaignEvent {
// Event Metadata
eventType: 'impression' | 'click';
timestamp: number;
searchId?: string;
sessionId?: string;
userId?: string;
// Surface Context
surface: {
type: 'search_results' | 'property_details' | 'email' | 'external_site' | 'mobile_app';
url: string;
referrer?: string;
placement: string; // 'top-left', 'header', 'sidebar', etc.
};
// System Context
system: {
applicationId: 'members' | 'groups' | 'spaces' | 'cars' | 'suppliers';
version: string; // consuming app version
environment: 'dev' | 'staging' | 'prod';
};
// Campaign Identity
campaign: {
id: string;
type: 'spotlight' | 'double_rewards' | 'deals';
treatment?: string; // 'position_one', 'sponsored', 'badgeless'
partnerId: string; // Who's paying for this
budgetCategory: 'property_owned' | 'externally_sponsored';
};
// Content Identity (for Ads - this is theoretical)
advertisement?: {
id: string;
creativeId: string;
contentType: 'destination_marketing' | 'property_promotion' | 'brand_awareness';
title?: string;
};
// Property Context
property: {
id: number;
position: number; // Position in search results/list
vertical: 'lodging' | 'groups' | 'spaces' | 'cars';
};
// Engagement Metrics (GTM-inspired)
engagement?: {
viewDuration?: number; // ms the element was visible
scrollDepth?: number; // How far user scrolled
interactionType?: 'hover' | 'focus' | 'click' | 'form_submit';
};
// Attribution Data
attribution: {
touchpointSequence: number; // 1st, 2nd, 3rd interaction in journey
attributionWindow: '1d' | '7d' | '30d';
conversionValue?: number;
};
// Experiment Context
experiments?: {
[experimentName: string]: string; // variant assignments
};
// Technical Context
technical: {
packageVersion: string;
browser: string;
deviceType: 'desktop' | 'mobile' | 'tablet';
viewportSize: { width: number; height: number };
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment