import * as _thumbmarkjs_thumbmarkjs from '@thumbmarkjs/thumbmarkjs'; export { ThumbmarkResponse } from '@thumbmarkjs/thumbmarkjs'; import { AxiosInstance, AxiosResponse } from 'axios'; /** * Provider group names for routing events to subsets of providers. * Assign groups via the `group` field on provider configs, then filter * by passing `groups` on `track()`, `identify()`, or `page()` calls. */ type ProviderGroup = 'marketing' | 'product' | 'infrastructure' | 'physical'; /** * Fields shared by every provider configuration block. * Set `enabled: true` to activate a provider for fan-out. * Providers are **disabled by default** — omitting `enabled` (or setting it to * `false`) means the provider is skipped entirely. */ interface BaseProviderConfig { /** Whether this provider is active. Defaults to `false` when omitted. */ enabled?: boolean; /** * Assign this provider to one or more groups for selective event routing. * When `groups` is specified on a track/identify/page call, only providers * whose group(s) intersect with the requested groups receive the event. * Ungrouped providers are excluded when groups filtering is active. */ group?: ProviderGroup | ProviderGroup[]; } type ConsentState = 'granted' | 'denied'; /** * Google Consent Mode v2 settings. * Controls how Google tags behave based on user consent. * * Key fields for Google Signals demographics (age, gender, interests): * - `ad_personalization` — must be `'granted'` for Google Signals to attribute * demographic data to sessions. * - `ad_user_data` — must be `'granted'` for user data to be sent to Google * for advertising purposes. */ interface ConsentSettings { /** Controls storage of advertising-related cookies. */ ad_storage?: ConsentState; /** Controls storage of analytics-related cookies. */ analytics_storage?: ConsentState; /** Controls whether user data can be sent to Google for advertising. */ ad_user_data?: ConsentState; /** Controls whether data can be used for personalized advertising. */ ad_personalization?: ConsentState; /** Controls storage for functional purposes (e.g. language settings). */ functionality_storage?: ConsentState; /** Controls storage for personalization (e.g. video recommendations). */ personalization_storage?: ConsentState; /** Controls storage for security purposes (e.g. authentication). */ security_storage?: ConsentState; } type ProviderName = 'google-analytics' | 'google-ads' | 'mixpanel' | 'segment' | 'amplitude' | 'plausible' | 'posthog' | 'meta-pixel' | 'clarity' | 'hotjar' | 'heap' | 'tiktok' | 'snapchat' | 'twitter' | 'reddit' | 'pinterest' | 'microsoft-ads' | 'newrelic'; /** * Standard event names that automatically map to each provider's native events. * Using these standardized names ensures consistent tracking across all providers. * * Provider-specific mappings: * - Google Ads: 'purchase' → 'purchase', 'lead' → 'lead', etc. * - Meta Pixel: Standard events (Purchase, Lead, etc.) * - GA4: Recommended events (purchase, lead, etc.) */ type StandardEventName = 'purchase' | 'lead' | 'sign_up' | 'login' | 'search' | 'add_to_cart' | 'add_to_wishlist' | 'begin_checkout' | 'remove_from_cart' | 'select_item' | 'select_promotion' | 'view_item' | 'view_item_list' | 'view_promotion' | 'view_cart' | 'add_payment_info' | 'add_shipping_info' | 'purchase_refund' | 'subscribe' | 'unsubscribe' | 'contact' | 'generate_lead' | 'schedule' | 'start_trial' | 'complete_registration' | 'donate' | 'share' | 'view_search_results' | 'bet_placed' | 'bet_settled' | 'bet_cancelled' | 'inplay_update' | 'deposit' | 'withdrawal' | 'session_timeout' | 'responsible_gambling_alert' | 'first_bet' | 'page_view'; /** * Exhaustive list of all standard event names for runtime lookups. * Kept in sync with `StandardEventName` — add new events to both. */ declare const STANDARD_EVENT_NAMES: readonly StandardEventName[]; /** Meta Pixel standard event names (PascalCase). */ type MetaPixelEventName = 'PageView' | 'Purchase' | 'AddToCart' | 'ViewContent' | 'InitiateCheckout' | 'Search' | 'Lead' | 'CompleteRegistration' | 'AddPaymentInfo' | 'AddToWishlist' | 'Contact' | 'StartTrial' | 'Subscribe' | 'Donate' | 'Schedule' | 'SubmitApplication' | 'CustomizeProduct' | 'FindLocation' | 'Login' | 'RemoveFromCart' | 'Share' | 'BetSettled' | 'BetCancelled' | 'InplayUpdate' | 'Deposit' | 'Withdrawal' | 'SessionTimeout' | 'ResponsibleGamblingAlert'; /** GA4 recommended event names (snake_case). */ type GA4EventName = 'purchase' | 'refund' | 'generate_lead' | 'sign_up' | 'login' | 'search' | 'add_to_cart' | 'add_to_wishlist' | 'begin_checkout' | 'remove_from_cart' | 'select_item' | 'select_promotion' | 'view_item' | 'view_item_list' | 'view_promotion' | 'view_cart' | 'add_payment_info' | 'add_shipping_info' | 'subscribe' | 'unsubscribe' | 'contact' | 'schedule' | 'start_trial' | 'complete_registration' | 'donate' | 'share' | 'view_search_results' | 'page_view' | 'bet_settled' | 'inplay_update' | 'deposit' | 'withdrawal' | 'session_timeout' | 'responsible_gambling_alert'; /** Google Ads conversion event names. */ type GoogleAdsEventName = 'purchase' | 'lead' | 'sign_up' | 'login' | 'search' | 'add_to_cart' | 'begin_checkout' | 'subscribe' | 'complete_registration' | 'contact' | 'generate_lead' | 'schedule' | 'start_trial' | 'donate'; /** Mixpanel / Amplitude event names (Title Case). */ type MixpanelEventName = 'Purchase' | 'Lead' | 'Sign Up' | 'Login' | 'Search' | 'Add to Cart' | 'Add to Wishlist' | 'Begin Checkout' | 'Remove from Cart' | 'Select Item' | 'Select Promotion' | 'View Item' | 'View Item List' | 'View Promotion' | 'View Cart' | 'Add Payment Info' | 'Add Shipping Info' | 'Purchase Refund' | 'Subscribe' | 'Unsubscribe' | 'Contact' | 'Generate Lead' | 'Schedule' | 'Start Trial' | 'Complete Registration' | 'Donate' | 'Share' | 'View Search Results' | 'Page View' | 'Bet Placed' | 'Bet Settled' | 'Bet Cancelled' | 'Inplay Update' | 'Deposit' | 'Withdrawal' | 'Session Timeout' | 'Responsible Gambling Alert' | 'First Bet'; /** TikTok standard event names (PascalCase). */ type TikTokEventName = 'CompletePayment' | 'CompleteRegistration' | 'Contact' | 'Subscribe' | 'SubmitForm' | 'ViewContent' | 'ClickButton' | 'Search' | 'AddToWishlist' | 'AddToCart' | 'InitiateCheckout' | 'AddPaymentInfo' | 'PlaceAnOrder' | 'Download'; /** Snapchat standard event names (UPPERCASE). */ type SnapchatEventName = 'PURCHASE' | 'SAVE' | 'START_CHECKOUT' | 'ADD_CART' | 'VIEW_CONTENT' | 'ADD_BILLING' | 'SIGN_UP' | 'SEARCH' | 'PAGE_VIEW' | 'SUBSCRIBE' | 'AD_CLICK' | 'AD_VIEW' | 'COMPLETE_TUTORIAL' | 'LEVEL_COMPLETE' | 'INVITE' | 'LOGIN' | 'SHARE' | 'RESERVE' | 'ACHIEVEMENT_UNLOCKED' | 'ADD_TO_WISHLIST' | 'SPENT_CREDITS' | 'RATE' | 'START_TRIAL' | 'LIST_VIEW'; /** Twitter/X Pixel event types (as used in Events Manager / Pixel). */ type TwitterEventName = 'PageView' | 'Purchase' | 'Download' | 'Lead' | 'AddToCart' | 'CheckoutInitiated' | 'ContentView' | 'AddedPaymentInfo' | 'Search' | 'Subscribe' | 'StartTrial' | 'AddToWishlist' | 'ProductCustomization' | 'SignUp'; /** Reddit Pixel / Conversions API standard event names (PascalCase). */ type RedditEventName = 'PageVisit' | 'ViewContent' | 'Search' | 'AddToCart' | 'AddToWishlist' | 'Purchase' | 'Lead' | 'SignUp' | 'Custom'; /** Pinterest Tag / Conversions API standard event names (lowercase). */ type PinterestEventName = 'page_visit' | 'view_content' | 'view_category' | 'search' | 'add_to_cart' | 'add_to_wishlist' | 'initiate_checkout' | 'add_payment_info' | 'checkout' | 'signup' | 'lead' | 'subscribe' | 'watch_video' | 'custom'; /** Microsoft Ads UET accepts any event action string — no restricted set. */ type MicrosoftAdsEventName = string; interface StandardItem { item_id?: string; item_name?: string; item_brand?: string; item_category?: string; item_variant?: string; price?: number; quantity?: number; coupon?: string; discount?: number; index?: number; [key: string]: unknown; } /** Properties for `purchase` and `purchase_refund` events. */ interface PurchaseEventProperties { value?: number; currency?: string; transaction_id?: string; tax?: number; shipping?: number; coupon?: string; items?: StandardItem[]; [key: string]: unknown; } /** Properties for `add_to_cart`, `remove_from_cart`, `view_item`, `view_cart` events. */ interface CartEventProperties { value?: number; currency?: string; items?: StandardItem[]; [key: string]: unknown; } /** Properties for `begin_checkout` event. */ interface CheckoutEventProperties { value?: number; currency?: string; coupon?: string; items?: StandardItem[]; [key: string]: unknown; } /** Properties for `add_payment_info` / `add_shipping_info` events. */ interface PaymentShippingEventProperties { value?: number; currency?: string; coupon?: string; payment_type?: string; shipping_tier?: string; items?: StandardItem[]; [key: string]: unknown; } /** Properties for `search` / `view_search_results` events. */ interface SearchEventProperties { search_term?: string; [key: string]: unknown; } /** Properties for `lead` / `generate_lead` events. */ interface LeadEventProperties { value?: number; currency?: string; [key: string]: unknown; } /** Properties for `sign_up` / `complete_registration` events. */ interface SignUpEventProperties { method?: string; [key: string]: unknown; } /** Properties for `login` event. */ interface LoginEventProperties { method?: string; [key: string]: unknown; } /** Properties for `share` event. */ interface ShareEventProperties { method?: string; content_type?: string; item_id?: string; [key: string]: unknown; } /** Properties for `select_item` / `view_item_list` events. */ interface ItemListEventProperties { item_list_id?: string; item_list_name?: string; items?: StandardItem[]; [key: string]: unknown; } /** Properties for `select_promotion` / `view_promotion` events. */ interface PromotionEventProperties { promotion_id?: string; promotion_name?: string; creative_name?: string; creative_slot?: string; items?: StandardItem[]; [key: string]: unknown; } /** Properties for `subscribe` / `start_trial` events. */ interface SubscriptionEventProperties { value?: number; currency?: string; plan?: string; [key: string]: unknown; } /** Properties for `donate` event. */ interface DonateEventProperties { value?: number; currency?: string; [key: string]: unknown; } /** Properties for `contact` / `schedule` events. */ interface ContactEventProperties { method?: string; [key: string]: unknown; } /** Properties for `bet_placed` events. */ interface BetPlacedEventProperties { /** Amount wagered. */ stake_amount?: number; /** Decimal odds at time of placement. */ odds?: number; /** Format the odds are expressed in. */ odds_format?: 'decimal' | 'fractional' | 'american'; /** Market type, e.g. 'match_winner', 'over_under', 'handicap'. */ market_type?: string; /** Sport name, e.g. 'football', 'basketball', 'tennis'. */ sport?: string; /** League / competition name, e.g. 'Premier League', 'NBA'. */ league?: string; /** Match or event name, e.g. 'Team A vs Team B'. */ event_name?: string; /** What was selected, e.g. 'Team A to Win'. */ selection?: string; /** Bet structure: 'single', 'accumulator', 'system', etc. */ bet_type?: string; /** Whether the bet was placed during live/in-play. */ is_live?: boolean; /** ISO 4217 currency code. */ currency?: string; /** Unique bet identifier. */ bet_id?: string; [key: string]: unknown; } /** Properties for `bet_settled` events. */ interface BetSettledEventProperties { /** Original stake amount. */ stake_amount?: number; /** Decimal odds at time of placement. */ odds?: number; /** Amount paid out (0 if lost). */ payout?: number; /** Net profit/loss (payout minus stake). */ profit_loss?: number; /** Settlement outcome. */ outcome?: 'won' | 'lost' | 'void' | 'push' | 'cashout'; /** How the bet was settled: 'normal', 'early_payout', 'cashout'. */ settlement_type?: string; /** Sport name. */ sport?: string; /** League / competition name. */ league?: string; /** Market type. */ market_type?: string; /** Bet structure. */ bet_type?: string; /** ISO 4217 currency code. */ currency?: string; /** Unique bet identifier. */ bet_id?: string; [key: string]: unknown; } /** Properties for `bet_cancelled` events. */ interface BetCancelledEventProperties { /** Original stake amount. */ stake_amount?: number; /** Decimal odds at time of placement. */ odds?: number; /** Reason for cancellation: 'user_cancelled', 'void', 'event_cancelled'. */ cancellation_reason?: string; /** Amount refunded to the player. */ refund_amount?: number; /** Sport name. */ sport?: string; /** League / competition name. */ league?: string; /** Market type. */ market_type?: string; /** ISO 4217 currency code. */ currency?: string; /** Unique bet identifier. */ bet_id?: string; [key: string]: unknown; } /** Properties for `inplay_update` events. */ interface InplayUpdateEventProperties { /** Sport name. */ sport?: string; /** League / competition name. */ league?: string; /** Unique match/fixture identifier. */ match_id?: string; /** Type of in-play event: 'goal', 'red_card', 'timeout', 'score_change'. */ event_type?: string; /** Home team/player score. */ score_home?: number; /** Away team/player score. */ score_away?: number; /** Current match minute or clock value. */ match_minute?: number; /** Current period: 'first_half', 'second_half', 'overtime', etc. */ period?: string; [key: string]: unknown; } /** Properties for `deposit` events. */ interface DepositEventProperties { /** Deposit amount. */ value?: number; /** ISO 4217 currency code. */ currency?: string; /** Payment method: 'credit_card', 'bank_transfer', 'e_wallet', etc. */ payment_method?: string; /** Whether this is the player's first deposit. */ is_first_deposit?: boolean; /** The player's nth deposit (lifetime count). */ deposit_count?: number; [key: string]: unknown; } /** Properties for `withdrawal` events. */ interface WithdrawalEventProperties { /** Withdrawal amount. */ value?: number; /** ISO 4217 currency code. */ currency?: string; /** Payment method: 'credit_card', 'bank_transfer', 'e_wallet', etc. */ payment_method?: string; [key: string]: unknown; } /** Properties for `session_timeout` events. */ interface SessionTimeoutEventProperties { /** Session duration in seconds. */ session_duration?: number; /** Warning level: 'reminder', 'timeout', 'forced_logout'. */ warning_level?: string; /** Reason for timeout: 'inactivity', 'time_limit', 'self_exclusion'. */ timeout_reason?: string; [key: string]: unknown; } /** Properties for `responsible_gambling_alert` events. */ interface ResponsibleGamblingAlertEventProperties { /** Alert type: 'deposit_limit', 'loss_limit', 'time_limit', 'reality_check', 'self_exclusion'. */ alert_type?: string; /** The limit/threshold that was reached. */ threshold?: number; /** The current value that triggered the alert. */ current_value?: number; /** Limit period: 'daily', 'weekly', 'monthly'. */ period?: string; /** Action taken: 'acknowledged', 'limit_reduced', 'self_excluded'. */ action_taken?: string; [key: string]: unknown; } /** Properties for `first_bet` events. */ interface FirstBetEventProperties { /** Amount wagered on the first bet. */ stake_amount?: number; /** Decimal odds at time of placement. */ odds?: number; /** Format the odds are expressed in. */ odds_format?: 'decimal' | 'fractional' | 'american'; /** Market type, e.g. 'match_winner', 'over_under', 'handicap'. */ market_type?: string; /** Sport name, e.g. 'football', 'basketball', 'tennis'. */ sport?: string; /** League / competition name, e.g. 'Premier League', 'NBA'. */ league?: string; /** Match or event name, e.g. 'Team A vs Team B'. */ event_name?: string; /** What was selected, e.g. 'Team A to Win'. */ selection?: string; /** Bet structure: 'single', 'accumulator', 'system', etc. */ bet_type?: string; /** Whether the bet was placed during live/in-play. */ is_live?: boolean; /** ISO 4217 currency code. */ currency?: string; /** Unique bet identifier. */ bet_id?: string; /** Registration source or channel. */ registration_source?: string; /** Time in seconds between registration and first bet. */ time_to_first_bet?: number; [key: string]: unknown; } /** * Properties for the `page_view` standard event. */ interface PageViewEventProperties { /** Page name or title. */ page_name?: string; /** Full page URL. */ url?: string; /** Referrer URL. */ referrer?: string; /** Page document title. */ title?: string; [key: string]: unknown; } /** * Maps each standard event name to its typed properties interface. * Use with `StandardEventProperties[E]` to get the properties type for event `E`. */ interface StandardEventProperties { purchase: PurchaseEventProperties; lead: LeadEventProperties; sign_up: SignUpEventProperties; login: LoginEventProperties; search: SearchEventProperties; add_to_cart: CartEventProperties; add_to_wishlist: CartEventProperties; begin_checkout: CheckoutEventProperties; remove_from_cart: CartEventProperties; select_item: ItemListEventProperties; select_promotion: PromotionEventProperties; view_item: CartEventProperties; view_item_list: ItemListEventProperties; view_promotion: PromotionEventProperties; view_cart: CartEventProperties; add_payment_info: PaymentShippingEventProperties; add_shipping_info: PaymentShippingEventProperties; purchase_refund: PurchaseEventProperties; subscribe: SubscriptionEventProperties; unsubscribe: Record; contact: ContactEventProperties; generate_lead: LeadEventProperties; schedule: ContactEventProperties; start_trial: SubscriptionEventProperties; complete_registration: SignUpEventProperties; donate: DonateEventProperties; share: ShareEventProperties; view_search_results: SearchEventProperties; bet_placed: BetPlacedEventProperties; bet_settled: BetSettledEventProperties; bet_cancelled: BetCancelledEventProperties; inplay_update: InplayUpdateEventProperties; deposit: DepositEventProperties; withdrawal: WithdrawalEventProperties; session_timeout: SessionTimeoutEventProperties; responsible_gambling_alert: ResponsibleGamblingAlertEventProperties; first_bet: FirstBetEventProperties; page_view: PageViewEventProperties; } /** * Mapping from standard event names to Meta Pixel native event names. * Full coverage required — every StandardEventName must map to a MetaPixelEventName. */ type MetaPixelEventMapping = Record; /** * Mapping from standard event names to GA4 native event names. * Full coverage required. */ type GA4EventMapping = Record; /** * Mapping from standard event names to Google Ads native event names. * Partial — not all standard events have a Google Ads equivalent. */ type GoogleAdsEventMapping = Partial>; /** * Mapping from standard event names to Mixpanel native event names. * Full coverage required. */ type MixpanelEventMapping = Record; /** * Mapping from standard event names to Amplitude native event names. * Uses the same Title Case convention as Mixpanel. */ type AmplitudeEventMapping = Record; /** * Mapping from standard event names to TikTok native event names. * Partial — not all standard events have a TikTok standard equivalent. * Non-betting events are mapped; betting events pass through as-is by default. */ type TikTokEventMapping = Partial>; /** * Mapping from standard event names to Snapchat native event names. * Partial — not all standard events have a Snapchat standard equivalent. */ type SnapchatEventMapping = Partial>; /** * Mapping from standard event names to Twitter/X native event names. * Partial — not all standard events have a Twitter standard equivalent. */ type TwitterEventMapping = Partial>; /** * Mapping from standard event names to Reddit native event names. * Partial — not all standard events have a Reddit standard equivalent. */ type RedditEventMapping = Partial>; /** * Mapping from standard event names to Pinterest native event names. * Partial — not all standard events have a Pinterest standard equivalent. */ type PinterestEventMapping = Partial>; /** * Mapping from standard event names to Microsoft Ads UET event action strings. * Partial — UET accepts any event name, so unmapped events pass through. */ type MicrosoftAdsEventMapping = Partial>; /** * Event taxonomy mapping configuration. * Each provider can define how standard events map to their native event names. */ /** * Mapping from standard property names to provider-specific property names. * Used for betting events where fields need to be renamed per provider. * * @example * ```ts * // GA4 expects 'value' for stake_amount * const ga4Mapping: BettingEventPropertyMapping = { * stake_amount: 'value', * currency: 'currency', * }; * ``` */ type BettingEventPropertyMapping = Partial>; interface EventTaxonomyConfig { /** Enable automatic event mapping. Default: true */ enabled?: boolean; /** Custom event name mappings (override defaults) */ customMappings?: Partial>; /** * Property mappings for betting events. * Maps standard betting event property names to provider-specific field names. * * @example * ```ts * propertyMappings: { * // GA4 expects 'value' and 'currency' for revenue * stake_amount: 'value', * currency: 'currency', * } * ``` */ propertyMappings?: BettingEventPropertyMapping; } /** * Options for track() with support for standardized events. */ interface TrackOptions { event: string | StandardEventName; /** * Event properties. Cross-provider linking properties are merged first, then user-defined * properties are merged on top (user properties take precedence). * * This type intersection enforces the correct merge order: `CrossProviderLinkingProperties` * (base) + user properties (override). TypeScript treats the left operand of `&` as the base. * * @example * ```ts * await mytart.track({ * event: 'purchase', * properties: { * value: 99.99, // user property * xpl_gclid: 'c...' // can override auto-merged linking prop * }, * }); * ``` */ properties?: Partial & Record; /** * User traits cached from a prior `identify()` call. Automatically merged * by Mytart — you do NOT need to pass this manually. Providers that support * user data enrichment on track calls (e.g. webhook) will include these. */ traits?: Record; userId?: string; anonymousId?: string; sessionId?: string; timestamp?: Date; context?: EventContext; /** Order/Transaction ID for deduplication and enhanced conversions */ orderId?: string; /** Revenue/value of the conversion */ value?: number; /** Currency code (ISO 4217) */ currency?: string; /** * Route this event only to providers belonging to the specified group(s). * When omitted, all enabled providers receive the event (default behaviour). * Providers with no `group` assigned are excluded when `groups` is set. */ groups?: ProviderGroup[]; } /** * Strongly-typed track options for a specific standard event. * Use this for IDE intellisense on event-specific properties. * * @example * ```ts * const opts: TypedTrackOptions<'purchase'> = { * event: 'purchase', * properties: { value: 99.99, currency: 'USD', items: [] }, * }; * ``` */ interface TypedTrackOptions { event: E; /** * Event-specific properties. Cross-provider linking properties are automatically * merged first, then these properties are merged on top (take precedence). */ properties?: StandardEventProperties[E] & Partial; userId?: string; anonymousId?: string; sessionId?: string; timestamp?: Date; context?: EventContext; orderId?: string; value?: number; currency?: string; /** * Route this event only to providers belonging to the specified group(s). * When omitted, all enabled providers receive the event (default behaviour). * Providers with no `group` assigned are excluded when `groups` is set. */ groups?: ProviderGroup[]; } type GoogleAnalyticsAppType = 'browser' | 'server'; /** * Properties automatically injected by `crossProviderLinking`. * These are typed for IDE support when using `properties` in track/identify/page. */ interface CrossProviderLinkingProperties { xpl_gclid?: string; xpl_fbclid?: string; xpl_ttclid?: string; xpl_msclkid?: string; xpl_li_fat_id?: string; xpl_fbp?: string; xpl_fbc?: string; xpl_ga_client_id?: string; xpl_sccid?: string; xpl_sc_cookie1?: string; xpl_twclid?: string; xpl_epik?: string; } /** * Configuration for the Google Analytics (GA4) provider. * * @example * ```ts * { * provider: 'google-analytics', * enabled: true, * measurementId: 'G-XXXXXXXXXX', * appType: 'browser', * debug: true, * signals: true, * } * ``` */ interface GoogleAnalyticsConfig extends BaseProviderConfig { provider: 'google-analytics'; /** * The GA4 Measurement ID for your data stream. * Found in GA4 under Admin › Data Streams › your stream. * * @example 'G-XXXXXXXXXX' */ measurementId: string; /** * API secret for the GA4 Measurement Protocol (server-side). * Generate one in GA4 under Admin › Data Streams › Measurement Protocol API secrets. * Required when `appType` is `'server'`. * * @example 'xYzAbCdEfGhIjKlM' */ apiSecret?: string; /** * A unique identifier for the client (device/browser instance). * In server mode this is required to associate hits with a user session. * In browser mode it is managed automatically by gtag.js and can be omitted. * * @example 'client-123456.7890123456' */ clientId?: string; /** * When `true`, enables GA4 debug mode. * In browser mode this sends events to the DebugView in the GA4 dashboard. * In server mode this sets `debug_mode: true` on Measurement Protocol payloads. * * @default false */ debug?: boolean; /** * Determines how events are sent to Google Analytics. * * - `'browser'` — injects the gtag.js snippet and uses `window.gtag()` calls. * Suitable for client-side web apps. * - `'server'` — sends events via the GA4 Measurement Protocol HTTP API. * Requires `apiSecret` and `clientId`. Suitable for Node.js / edge / SSR. * * @default 'browser' */ appType?: GoogleAnalyticsAppType; /** * Default consent state set before gtag('config'). In browser mode this * emits `gtag('consent', 'default', ...)` so Google tags respect user * consent from the very first hit. Use `Mytart.updateConsent()` to change * consent at runtime (e.g. after a cookie banner interaction). * * For Google Signals demographics, `ad_personalization` and `ad_user_data` * must eventually be set to `'granted'`. */ defaultConsent?: ConsentSettings; /** * When `true`, sets `wait_for_update` (in milliseconds) on the default * consent command. This tells Google tags to wait the specified number of * milliseconds for a consent update before sending the first hit. Useful * when a consent management platform loads asynchronously. * Defaults to `undefined` (no wait). */ consentWaitForUpdate?: number; /** * Convenience flag to enable or disable Google Signals for demographics * (age, gender, interests). * * - `true` — passes `allow_google_signals: true` and * `allow_ad_personalization_signals: true` in the `gtag('config')` * call. If `defaultConsent` is not explicitly set, automatically * configures Consent Mode v2 to grant `ad_personalization`, * `ad_user_data`, `ad_storage`, and `analytics_storage`. * - `false` — passes `allow_google_signals: false` and * `allow_ad_personalization_signals: false` to explicitly disable * Google Signals. * - `undefined` (default) — uses Google's default behaviour (Signals * enabled when the GA4 property has it turned on in Admin). * * **Note**: Google Signals must also be enabled in the GA4 admin panel * (Admin › Data Settings › Data Collection) for demographic data to * appear. This flag controls the client-side consent and config only. */ signals?: boolean; /** * Event taxonomy configuration for GA4. * Allows custom event name mappings and disabling auto-mapping. * * @example * ```ts * eventTaxonomy: { * customMappings: { lead: 'custom_lead_event' }, * } * ``` */ eventTaxonomy?: EventTaxonomyConfig; } type GoogleAdsAppType = 'browser' | 'server'; /** * User identifiers for Google Ads Enhanced Conversions. * These are hashed (SHA-256) before being sent to the API. * At least one identifier is required for enhanced conversions. */ interface GoogleAdsUserIdentifier { /** * Email address. Will be normalized (lowercase, Gmail rules) and hashed. * @example 'user@example.com' */ email?: string; /** * Phone number in E.164 format with leading +. * @example '+1 800 5550102' */ phone?: string; /** * Address information for enhanced matching. */ address?: { /** First name (will be hashed) */ firstName: string; /** Last name (will be hashed) */ lastName: string; /** Country code (NOT hashed, 2-letter ISO) */ countryCode: string; /** Postal/ZIP code (NOT hashed) */ postalCode: string; /** Street address (will be hashed, optional) */ streetAddress?: string; /** City (NOT hashed, optional) */ city?: string; /** State/region (NOT hashed, optional) */ state?: string; }; } /** * Configuration for the Google Ads provider. * Supports both browser (gtag.js conversion tracking) and server * (Google Ads API for enhanced conversions) modes. * * @example * ```ts * // Browser mode * { * provider: 'google-ads', * enabled: true, * conversionActionId: 'AW-123456789/AbC1dEfG2hIjK3lM', * appType: 'browser', * } * ``` * * @example * ```ts * // Server mode (Enhanced Conversions) * { * provider: 'google-ads', * enabled: true, * conversionActionId: 'AW-123456789/AbC1dEfG2hIjK3lM', * customerId: '123-456-7890', * appType: 'server', * userIdentifiers: ['email', 'phone'], * } * ``` */ interface GoogleAdsConfig extends BaseProviderConfig { provider: 'google-ads'; /** * The conversion action ID (also called conversion label). * Format: AW-XXXXXXXXXX/XXXXXXXXXX * Found in Google Ads under Tools & Settings › Conversions. * * @example 'AW-123456789/AbC1dEfG2hIjK3lM' */ conversionActionId: string; /** * Google Ads Customer ID (10-digit format with hyphens). * Required for server mode. Found in Google Ads account header. * * @example '123-456-7890' */ customerId?: string; /** * OAuth2 access token for Google Ads API. * Required for server mode. Generate via OAuth2 or service account. */ accessToken?: string; /** * Developer token for Google Ads API. * Required for server mode. Apply in Google Ads API Center. */ developerToken?: string; /** * Login customer ID for MCC accounts. * Use when the OAuth credentials belong to an MCC manager account. */ loginCustomerId?: string; /** * Determines how conversions are sent. * * - `'browser'` — uses gtag.js `gtag('event', 'conversion', ...)` * - `'server'` — sends via Google Ads API (Enhanced Conversions) * * @default 'browser' */ appType?: GoogleAdsAppType; /** * Which user identifiers to send for enhanced conversions. * In browser mode, these are sent via gtag. In server mode, they're * included in the API payload (hashed with SHA-256). * * @default ['email'] */ userIdentifiers?: ('email' | 'phone' | 'address')[]; /** * Default user identifiers to use for all conversions. * These will be merged with per-event identifiers from track() calls. */ defaultUserIdentifier?: GoogleAdsUserIdentifier; /** * Enable debug mode for the Google Ads API. * In server mode, this enables request validation without processing. */ debug?: boolean; /** * Google Ads API version for server mode. * Defaults to `'v23'`. Override to target a specific API version. * * @default 'v23' */ apiVersion?: string; /** * Event taxonomy configuration for mapping standard events * to Google Ads conversion actions. */ eventTaxonomy?: EventTaxonomyConfig; } /** * Configuration for the Mixpanel provider. * * @example * ```ts * { * provider: 'mixpanel', * enabled: true, * token: 'abc123def456', * } * ``` */ interface MixpanelConfig extends BaseProviderConfig { provider: 'mixpanel'; /** * Your Mixpanel project token. * Found in Mixpanel under Settings › Project Settings › Project Token. * * @example 'abc123def456' */ token: string; /** * Custom Mixpanel API endpoint. Use this if you are routing events through * a proxy or using Mixpanel's EU residency endpoint. * * @default 'https://api.mixpanel.com' * @example 'https://api-eu.mixpanel.com' */ apiUrl?: string; /** * Optional event taxonomy configuration for custom event name mappings. * Allows overriding default Mixpanel Title Case mappings or disabling auto-mapping. */ eventTaxonomy?: EventTaxonomyConfig; } /** * Configuration for the Segment provider. * * @example * ```ts * { * provider: 'segment', * enabled: true, * writeKey: 'wk_abc123...', * } * ``` */ interface SegmentConfig extends BaseProviderConfig { provider: 'segment'; /** * The Segment source Write Key. * Found in Segment under Sources › your source › Settings › API Keys. * * @example 'wk_abc123def456ghi789' */ writeKey: string; /** * Custom Segment API endpoint. Use this if you are routing events through * a proxy or a custom Segment data plane. * * @default 'https://api.segment.io/v1' * @example 'https://events.yourdomain.com/v1' */ apiUrl?: string; } /** * Configuration for the Amplitude provider. * * @example * ```ts * { * provider: 'amplitude', * enabled: true, * apiKey: 'your-amplitude-api-key', * } * ``` */ interface AmplitudeConfig extends BaseProviderConfig { provider: 'amplitude'; /** * Your Amplitude project API key. * Found in Amplitude under Settings › Projects › your project › General. * * @example 'a1b2c3d4e5f6a1b2c3d4e5f6' */ apiKey: string; /** * Custom Amplitude API endpoint. Use this if you are routing events through * a proxy or using Amplitude's EU data centre. * * @default 'https://api2.amplitude.com/2/httpapi' * @example 'https://api.eu.amplitude.com/2/httpapi' */ apiUrl?: string; /** * Optional event taxonomy configuration for custom event name mappings. * Allows overriding default Amplitude Title Case mappings or disabling auto-mapping. */ eventTaxonomy?: EventTaxonomyConfig; } /** * Configuration for the Plausible Analytics provider. * * Plausible is a privacy-focused analytics platform. Server-side usage * requires `userAgent` and `xForwardedFor` so Plausible can attribute * visits without cookies. * * @example * ```ts * // Browser usage * { * provider: 'plausible', * enabled: true, * domain: 'example.com', * } * ``` * * @example * ```ts * // Server-side usage * { * provider: 'plausible', * enabled: true, * domain: 'example.com', * apiUrl: 'https://plausible.example.com', * userAgent: req.headers['user-agent'], * xForwardedFor: req.headers['x-forwarded-for'], * } * ``` */ interface PlausibleConfig extends BaseProviderConfig { provider: 'plausible'; /** * The domain name of the site as configured in your Plausible dashboard. * Must match exactly (no protocol, no trailing slash). * * @example 'example.com' */ domain: string; /** * Custom Plausible API endpoint. Use this if you self-host Plausible * or route events through a proxy to avoid ad-blockers. * * @default 'https://plausible.io' * @example 'https://plausible.example.com' */ apiUrl?: string; /** * The visitor's User-Agent string. Required for server-side usage so * Plausible can perform unique-visitor counting without cookies. * * @example 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) ...' */ userAgent?: string; /** * The visitor's IP address, used by Plausible for geolocation and * unique-visitor hashing. Required for server-side usage. * Pass the `X-Forwarded-For` header value from the incoming request. * * @example '203.0.113.42' */ xForwardedFor?: string; } /** * Configuration for the PostHog provider. * * @example * ```ts * { * provider: 'posthog', * enabled: true, * apiKey: 'phc_abc123def456', * } * ``` * * @example * ```ts * // Self-hosted PostHog * { * provider: 'posthog', * enabled: true, * apiKey: 'phc_abc123def456', * apiUrl: 'https://posthog.example.com', * } * ``` */ interface PostHogConfig extends BaseProviderConfig { provider: 'posthog'; /** * Your PostHog project API key (starts with `phc_`). * Found in PostHog under Project Settings › Project API Key. * * @example 'phc_abc123def456ghi789' */ apiKey: string; /** * Custom PostHog API endpoint. Use this if you self-host PostHog * or use PostHog's EU cloud instance. * * @default 'https://us.i.posthog.com' (PostHog US Cloud) * @example 'https://eu.i.posthog.com' */ apiUrl?: string; } /** * Advanced Matching data for the Meta Pixel. * In browser mode these fields are passed to `fbq('init', pixelId, matchData)`. * In server mode they are included in the `user_data` object sent to the * Conversions API — plain-text values are automatically SHA-256 hashed before * sending. * * @example * ```ts * { * em: 'user@example.com', * fn: 'jane', * ln: 'doe', * country: 'us', * } * ``` */ interface MetaPixelAdvancedMatching { /** * Email address. Lowercased before hashing. * @example 'user@example.com' */ em?: string; /** * Phone number including country code, digits only (no dashes or spaces). * @example '15551234567' */ ph?: string; /** * First name. Lowercased before hashing. * @example 'jane' */ fn?: string; /** * Last name. Lowercased before hashing. * @example 'doe' */ ln?: string; /** * Gender. Single lowercase letter: `'m'` for male, `'f'` for female. * @example 'm' */ ge?: string; /** * Date of birth in `YYYYMMDD` format. * @example '19900115' */ db?: string; /** * City name. Lowercased, no spaces or punctuation. * @example 'newyork' */ ct?: string; /** * State or province as a 2-letter code. Lowercased. * @example 'ny' */ st?: string; /** * Zip or postal code. For US, use 5-digit format. * @example '10001' */ zp?: string; /** * Country as a 2-letter ISO 3166-1 alpha-2 code. Lowercased. * @example 'us' */ country?: string; /** * External ID — your own unique identifier for the user. * Useful for deduplicating browser and server events. * @example 'user_abc123' */ external_id?: string; } type MetaPixelAppType = 'browser' | 'server'; /** * Configuration for the Meta Pixel (Facebook Pixel) provider. * Supports both browser-side pixel tracking and server-side Conversions API. * * @example * ```ts * // Browser mode * { * provider: 'meta-pixel', * enabled: true, * pixelId: '1234567890', * appType: 'browser', * debug: true, * } * ``` * * @example * ```ts * // Server mode (Conversions API) * { * provider: 'meta-pixel', * enabled: true, * pixelId: '1234567890', * appType: 'server', * accessToken: 'EAABsb...', * testEventCode: 'TEST12345', * } * ``` */ interface MetaPixelConfig extends BaseProviderConfig { provider: 'meta-pixel'; /** * The Meta Pixel ID (numeric string). * Found in Meta Events Manager under your pixel's settings. * * @example '1234567890' */ pixelId: string; /** * Access token for the Conversions API. Required when `appType` is * `'server'` — ignored in browser mode. */ accessToken?: string; /** * `'browser'` injects the official fbevents.js snippet and calls `window.fbq()`. * `'server'` (default) sends events via the Conversions API HTTP endpoint. */ appType?: MetaPixelAppType; /** * Graph API version to use for the Conversions API. * Defaults to `'v21.0'`. */ apiVersion?: string; /** * Test Event Code for the Events Manager Test Events tool. * Only used in server mode (Conversions API). */ testEventCode?: string; /** * Advanced Matching data passed to `fbq('init')` in browser mode. * In server mode this populates the initial `user_data` for all events. */ advancedMatching?: MetaPixelAdvancedMatching; /** * When `true` (default), the Pixel uses Automatic Configuration * (auto-detects button clicks, page metadata, etc.). * Set to `false` to disable. */ autoConfig?: boolean; /** Enable Meta Pixel debug mode (`fbq('set', 'debug', true)`). */ debug?: boolean; /** * The action source for server-mode events. * Indicates where the conversion event originated. * * - `'website'` — web browser events (default) * - `'app'` — mobile app events * - `'phone_call'` — call-center / IVR conversions * - `'chat'` — messaging / live-chat conversions * - `'email'` — email-driven conversions * - `'physical_store'` — in-store / POS conversions (allows event_time up to 62 days in past) * - `'system_generated'` — CRM / back-end system events * - `'business_messaging'` — WhatsApp / Messenger business conversations * - `'other'` — catch-all for uncategorized sources * * Can also be overridden per-event via `properties.action_source`. * * @default 'website' */ actionSource?: 'website' | 'app' | 'phone_call' | 'chat' | 'email' | 'physical_store' | 'system_generated' | 'business_messaging' | 'other'; /** * Event taxonomy configuration for mapping standard events * to Meta Pixel native event names. */ eventTaxonomy?: EventTaxonomyConfig; } /** * Configuration for the Microsoft Clarity provider. * Clarity provides session recordings, heatmaps, and behavioral analytics. * Browser-only — this provider is a no-op in server environments. * * @example * ```ts * { * provider: 'clarity', * enabled: true, * projectId: 'abc123def4', * cookie: true, * } * ``` */ interface ClarityConfig extends BaseProviderConfig { provider: 'clarity'; /** * The Clarity project ID found in your Clarity dashboard under * Settings › Overview › Project ID. * * @example 'abc123def4' */ projectId: string; /** * Enable Clarity cookie consent mode. When `true`, calls * `clarity('consent')` after initialisation so Clarity sets cookies. * When omitted or `false`, Clarity operates in cookieless mode. */ cookie?: boolean; } /** * Configuration for the Hotjar provider. * Hotjar provides heatmaps, session recordings, and user feedback. * Browser-only — this provider is a no-op in server environments. * * @example * ```ts * { * provider: 'hotjar', * enabled: true, * siteId: 123456, * } * ``` */ interface HotjarConfig extends BaseProviderConfig { provider: 'hotjar'; /** * Your Hotjar site ID. * Found in Hotjar under Sites & Organizations › your site. * * @example 123456 */ siteId: number; /** * Hotjar SDK version to use. Defaults to 6. * * @default 6 */ version?: number; /** * Enable Hotjar debug mode. * * @default false */ debug?: boolean; } /** * Configuration for the Heap provider. * Heap provides product analytics with retroactive event capture. * Supports both browser (client SDK) and server (HTTP API) modes. * * @example * ```ts * // Browser mode * { * provider: 'heap', * enabled: true, * appId: '123456789', * appType: 'browser', * } * ``` * * @example * ```ts * // Server mode (HTTP API) * { * provider: 'heap', * enabled: true, * appId: '123456789', * appType: 'server', * } * ``` */ type HeapAppType = 'browser' | 'server'; interface HeapConfig extends BaseProviderConfig { provider: 'heap'; /** * Your Heap application ID (environment ID). * Found in Heap under Account › Privacy & Security › API. * * @example '123456789' */ appId: string; /** * Determines how events are sent to Heap. * * - `'browser'` — uses the Heap client SDK via `window.heap(...)`. * Suitable for client-side web apps. * - `'server'` — sends events via Heap's HTTP API. * Requires `appId`. Suitable for Node.js / edge / SSR. * * @default 'server' */ appType?: HeapAppType; /** * Enable Heap debug mode. * * @default false */ debug?: boolean; } type TikTokAppType = 'browser' | 'server'; /** * Configuration for the TikTok provider. * Supports both browser (TikTok pixel / ttq) and server (Events API v1.3) modes. * * @example * ```ts * // Browser mode * { * provider: 'tiktok', * enabled: true, * pixelCode: 'CXXXXXXXXXXXXXXXXX', * appType: 'browser', * } * ``` * * @example * ```ts * // Server mode (Events API v1.3) * { * provider: 'tiktok', * enabled: true, * pixelCode: 'CXXXXXXXXXXXXXXXXX', * accessToken: 'your-access-token', * appType: 'server', * testEventCode: 'TEST12345', * } * ``` */ interface TikTokConfig extends BaseProviderConfig { provider: 'tiktok'; /** * The TikTok Pixel Code (also called pixel ID). * Found in TikTok Events Manager under your pixel's settings. * * @example 'CXXXXXXXXXXXXXXXXX' */ pixelCode: string; /** * Access token for the TikTok Events API. * Required when `appType` is `'server'`. * Generated in TikTok Events Manager under Settings › Events API. */ accessToken?: string; /** * Determines how events are sent to TikTok. * * - `'browser'` — injects the TikTok pixel script and uses `window.ttq` calls. * Suitable for client-side web apps. * - `'server'` — sends events via the TikTok Events API v1.3 HTTP endpoint. * Requires `accessToken`. Suitable for Node.js / edge / SSR. * * @default 'server' */ appType?: TikTokAppType; /** * TikTok Events API version. Defaults to `'v1.3'`. * * @default 'v1.3' */ apiVersion?: string; /** * Test Event Code for the TikTok Events Manager Test Events tool. * Only used in server mode (Events API). */ testEventCode?: string; /** * The event source for server-mode events. * Indicates where the conversion event originated. * * - `'web'` — web browser events (default) * - `'app'` — mobile app events * - `'offline'` — offline / in-store conversions * - `'crm'` — CRM system events * * @default 'web' */ eventSource?: 'web' | 'app' | 'offline' | 'crm'; /** * Event taxonomy configuration for mapping standard events * to TikTok native event names. */ eventTaxonomy?: EventTaxonomyConfig; } type SnapchatAppType = 'browser' | 'server'; /** * Configuration for the Snapchat provider. * Supports both browser (Snap Pixel / snaptr) and server (Conversions API v3) modes. * * @example * ```ts * // Browser mode * { * provider: 'snapchat', * enabled: true, * pixelId: '1234567890', * appType: 'browser', * } * ``` * * @example * ```ts * // Server mode (Conversions API v3) * { * provider: 'snapchat', * enabled: true, * pixelId: '1234567890', * accessToken: 'your-access-token', * appType: 'server', * } * ``` */ interface SnapchatConfig extends BaseProviderConfig { provider: 'snapchat'; /** * The Snap Pixel ID. * Found in Snapchat Ads Manager under Events Manager › your pixel. * * @example '1234567890' */ pixelId: string; /** * Access token for the Snapchat Conversions API. * Required when `appType` is `'server'`. * Generated in Snapchat Business Manager. */ accessToken?: string; /** * Determines how events are sent to Snapchat. * * - `'browser'` — injects the Snap Pixel script and uses `window.snaptr` calls. * Suitable for client-side web apps. * - `'server'` — sends events via the Snapchat Conversions API v3 HTTP endpoint. * Requires `accessToken`. Suitable for Node.js / edge / SSR. * * @default 'server' */ appType?: SnapchatAppType; /** * Test Event Code for the Snapchat Events Manager Test Events tool. * Only used in server mode (Conversions API). */ testEventCode?: string; /** * Enable debug/validate mode. When `true`, events are sent to the * validation endpoint instead of the live endpoint. * * @default false */ debug?: boolean; /** * The action source for server-mode events. * Indicates where the conversion event originated. * * - `'WEB'` — web browser events (default) * - `'MOBILE_APP'` — mobile app events * - `'OFFLINE'` — offline / in-store conversions * * @default 'WEB' */ actionSource?: 'WEB' | 'MOBILE_APP' | 'OFFLINE'; /** * Event taxonomy configuration for mapping standard events * to Snapchat native event names. */ eventTaxonomy?: EventTaxonomyConfig; } type TwitterAppType = 'browser' | 'server'; /** * Configuration for the Twitter/X provider. * Supports both browser (X Pixel / twq) and server (Conversion API) modes. * * @example * ```ts * // Browser mode * { * provider: 'twitter', * enabled: true, * pixelId: 'oka17', * appType: 'browser', * } * ``` * * @example * ```ts * // Server mode (Conversion API) * { * provider: 'twitter', * enabled: true, * pixelId: 'oka17', * appType: 'server', * oauthCredentials: { * consumerKey: '...', * consumerSecret: '...', * accessToken: '...', * accessTokenSecret: '...', * }, * } * ``` */ interface TwitterConfig extends BaseProviderConfig { provider: 'twitter'; /** * The X Pixel ID (also called the Base Tag ID / UWT ID). * Found in X Ads Manager under Events Manager. * * @example 'oka17' */ pixelId: string; /** * The event ID for tracking specific conversion events via the Conversion API. * Must be a Single Event Tag (SET) ID. * Can be the short form (e.g. 'ol288') or the full form (e.g. 'tw-oka17-ol288'). * * @example 'ol288' */ eventId?: string; /** * OAuth 1.0a credentials for the Conversion API (server mode). * Required when `appType` is `'server'`. * Generated via the X Ads API application. */ oauthCredentials?: { consumerKey: string; consumerSecret: string; accessToken: string; accessTokenSecret: string; }; /** * Determines how events are sent to Twitter/X. * * - `'browser'` — injects the X Pixel script (`uwt.js`) and uses `window.twq` calls. * Suitable for client-side web apps. * - `'server'` — sends events via the X Conversion API HTTP endpoint. * Requires `oauthCredentials`. Suitable for Node.js / edge / SSR. * * @default 'server' */ appType?: TwitterAppType; /** * The X Ads API version to use for server mode. * * @default '12' */ apiVersion?: string; /** * Enable debug mode. Currently a passthrough for `debugInfo` capture. * * @default false */ debug?: boolean; /** * Event taxonomy configuration for mapping standard events * to Twitter/X native event names. */ eventTaxonomy?: EventTaxonomyConfig; } type RedditAppType = 'browser' | 'server'; /** * Configuration for the Reddit provider. * Supports both browser (Reddit Pixel / rdt) and server (Conversions API) modes. * * @example * ```ts * // Browser mode * { * provider: 'reddit', * enabled: true, * pixelId: 't2_abc123', * appType: 'browser', * } * ``` * * @example * ```ts * // Server mode (Conversions API) * { * provider: 'reddit', * enabled: true, * pixelId: 't2_abc123', * accountId: 't2_abc123', * accessToken: 'your-access-token', * appType: 'server', * } * ``` */ interface RedditConfig extends BaseProviderConfig { provider: 'reddit'; /** * The Reddit Pixel ID (advertiser ID). * Found in Reddit Ads Manager under Events Manager. * * @example 't2_abc123' */ pixelId: string; /** * Reddit advertiser account ID for the Conversions API. * Required when `appType` is `'server'`. * * @example 't2_abc123' */ accountId?: string; /** * Access token for the Reddit Conversions API. * Required when `appType` is `'server'`. * Generated via Reddit Ads OAuth flow. */ accessToken?: string; /** * Determines how events are sent to Reddit. * * - `'browser'` — injects the Reddit Pixel script and uses `window.rdt` calls. * Suitable for client-side web apps. * - `'server'` — sends events via the Reddit Conversions API HTTP endpoint. * Requires `accountId` and `accessToken`. Suitable for Node.js / edge / SSR. * * @default 'server' */ appType?: RedditAppType; /** * Enable test mode for the Conversions API. * When `true`, events are processed but not used for ad optimization. * * @default false */ testMode?: boolean; /** * Enable debug mode. Currently a passthrough for `debugInfo` capture. * * @default false */ debug?: boolean; /** * Event taxonomy configuration for mapping standard events * to Reddit native event names. */ eventTaxonomy?: EventTaxonomyConfig; } type PinterestAppType = 'browser' | 'server'; /** * Configuration for the Pinterest provider. * Supports both browser (Pinterest Tag / pintrk) and server (Conversions API) modes. * * @example * ```ts * // Browser mode * { * provider: 'pinterest', * enabled: true, * tagId: '123456789', * appType: 'browser', * } * ``` * * @example * ```ts * // Server mode (Conversions API) * { * provider: 'pinterest', * enabled: true, * tagId: '123456789', * adAccountId: '123456789', * accessToken: 'your-access-token', * appType: 'server', * } * ``` */ interface PinterestConfig extends BaseProviderConfig { provider: 'pinterest'; /** * The Pinterest Tag ID (13-digit number). * Found in Pinterest Ads Manager under Conversions. * * @example '123456789012' */ tagId: string; /** * Pinterest ad account ID for the Conversions API. * Required when `appType` is `'server'`. * * @example '123456789012' */ adAccountId?: string; /** * Access token for the Pinterest Conversions API. * Required when `appType` is `'server'`. * Generated via Pinterest Ads Manager or OAuth. */ accessToken?: string; /** * Determines how events are sent to Pinterest. * * - `'browser'` — injects the Pinterest Tag script and uses `window.pintrk` calls. * Suitable for client-side web apps. * - `'server'` — sends events via the Pinterest Conversions API HTTP endpoint. * Requires `adAccountId` and `accessToken`. Suitable for Node.js / edge / SSR. * * @default 'server' */ appType?: PinterestAppType; /** * The action source for server-mode events. * Indicates where the conversion event occurred. * * @default 'web' */ actionSource?: 'web' | 'app_android' | 'app_ios' | 'offline'; /** * Enable test mode for the Conversions API. * When `true`, adds `?test=true` query param — events are validated * but not recorded. * * @default false */ testMode?: boolean; /** * Enable debug mode. Currently a passthrough for `debugInfo` capture. * * @default false */ debug?: boolean; /** * Event taxonomy configuration for mapping standard events * to Pinterest native event names. */ eventTaxonomy?: EventTaxonomyConfig; } type MicrosoftAdsAppType = 'browser' | 'server'; /** * Microsoft Advertising (Bing Ads) UET configuration. * * Browser mode injects the official UET tag (`bat.bing.com/bat.js`) and * tracks events via `window.uetq.push(...)`. * * Server mode uploads offline conversions via the Microsoft Advertising * Campaign Management API (REST/JSON). * * @example * ```ts * // Browser mode * { provider: 'microsoft-ads', tagId: '12345678', appType: 'browser' } * * // Server mode * { * provider: 'microsoft-ads', * tagId: '12345678', * accessToken: 'your-oauth-token', * developerToken: 'your-dev-token', * customerId: '123456', * accountId: '654321', * appType: 'server', * } * ``` */ interface MicrosoftAdsConfig extends BaseProviderConfig { provider: 'microsoft-ads'; /** * The UET tag ID (numeric string). * Found in Microsoft Advertising under Conversion Tracking › UET tags. * * @example '12345678' */ tagId: string; /** * OAuth2 access token for the Microsoft Advertising API. * Required when `appType` is `'server'`. */ accessToken?: string; /** * Developer token for the Microsoft Advertising API. * Required when `appType` is `'server'`. * Apply in the Microsoft Advertising Developer Portal. */ developerToken?: string; /** * Microsoft Advertising customer ID. * Required when `appType` is `'server'`. */ customerId?: string; /** * Microsoft Advertising account ID. * Required when `appType` is `'server'`. */ accountId?: string; /** * Default conversion goal name for server-mode offline conversions. * If set, all `track()` events use this as the `ConversionName`. * If not set, the (mapped) event name is used. */ defaultConversionName?: string; /** * Determines how events are sent to Microsoft Advertising. * * - `'browser'` — injects the UET tag script and uses `window.uetq` calls. * Suitable for client-side web apps. * - `'server'` — uploads offline conversions via the Campaign Management API. * Requires `accessToken`, `developerToken`, `customerId`, and `accountId`. * Suitable for Node.js / edge / SSR. * * @default 'server' */ appType?: MicrosoftAdsAppType; /** * Enable debug mode. Currently a passthrough for `debugInfo` capture. * * @default false */ debug?: boolean; /** * Event taxonomy configuration for mapping standard events * to Microsoft Ads UET event action strings. */ eventTaxonomy?: EventTaxonomyConfig; } type ProviderConfig = GoogleAnalyticsConfig | GoogleAdsConfig | MixpanelConfig | SegmentConfig | AmplitudeConfig | PlausibleConfig | PostHogConfig | MetaPixelConfig | ClarityConfig | HotjarConfig | HeapConfig | TikTokConfig | SnapchatConfig | TwitterConfig | RedditConfig | PinterestConfig | MicrosoftAdsConfig | WebhookConfig | NewRelicConfig; interface WebhookConfig extends BaseProviderConfig { provider: 'webhook'; /** * Your custom webhook URL. * * @example 'https://your-server.com/webhook' */ url: string; /** * Optional API key for authentication. * Sent as `X-API-Key` header. */ apiKey?: string; /** * Optional Bearer token for authentication. * Sent as `Authorization: Bearer ` header. */ bearerToken?: string; /** * When `true`, includes the full `fingerprintData` (ThumbmarkJS response) * in webhook payloads. Disabled by default to keep payloads small. * `fingerprintId` is always included regardless of this setting. */ includeFingerprintData?: boolean; /** * Custom headers to include with every request. */ headers?: Record; } /** * New Relic region for ingest API endpoints. * Determines whether to use `newrelic.com` (US) or `eu.newrelic.com` (EU). */ type NewRelicRegion = 'us' | 'eu'; /** * Which New Relic ingest APIs to send data to. * - `log`: Send events as structured log entries via the Log API. * - `metric`: Send events as dimensional gauge metrics via the Metric API. * - `both`: Send to both APIs concurrently. */ type NewRelicMode = 'log' | 'metric' | 'both'; /** * A single log entry payload for the New Relic Log API. * @see https://docs.newrelic.com/docs/logs/log-api/introduction-log-api/ */ interface NewRelicLogEntry { /** Log message (we use the event name). */ message: string; /** Unix epoch timestamp in milliseconds. */ timestamp: number; /** Structured attributes attached to this log entry. */ attributes: Record; } /** * Payload wrapper for the New Relic Log API. * The API accepts an array of log entries. */ type NewRelicLogPayload = [NewRelicLogEntry]; /** * A single metric data point for the New Relic Metric API. * We use the `gauge` type exclusively — each event is a single data point. * @see https://docs.newrelic.com/docs/data-apis/ingest-apis/metric-api/report-metrics-metric-api/ */ interface NewRelicMetricEntry { /** Metric name, e.g. `custom.purchase`. */ name: string; /** Metric type — always `gauge` for analytics events. */ type: 'gauge'; /** Metric value (from TrackOptions.value, or 1 as event count). */ value: number; /** Unix epoch timestamp in milliseconds. */ timestamp: number; /** Dimensional attributes for filtering/grouping. */ attributes: Record; } /** * Payload wrapper for the New Relic Metric API. * The API accepts an array of these objects. */ interface NewRelicMetricPayload { /** Common attributes applied to all metrics in this payload. */ common?: { /** Unix epoch timestamp in milliseconds. */ timestamp: number; /** Common dimensional attributes. */ attributes?: Record; }; /** Array of metric data points. */ metrics: [NewRelicMetricEntry]; } /** * Configuration for the New Relic provider. * Sends analytics events to New Relic as structured logs, metrics, or both. * * @example * ```ts * // Log mode — events as structured log entries * { * provider: 'newrelic', * enabled: true, * licenseKey: 'NRAL-...', * mode: 'log', * } * ``` * * @example * ```ts * // Metric mode — events as gauge metrics * { * provider: 'newrelic', * enabled: true, * licenseKey: 'NRAL-...', * mode: 'metric', * metricPrefix: 'myapp.', * } * ``` * * @example * ```ts * // Both mode — events sent to both APIs * { * provider: 'newrelic', * enabled: true, * licenseKey: 'NRAL-...', * mode: 'both', * region: 'eu', * commonAttributes: { environment: 'production' }, * } * ``` */ interface NewRelicConfig extends BaseProviderConfig { provider: 'newrelic'; /** * Your New Relic License Key. * Used as the `Api-Key` header for all ingest API requests. * * @example 'NRAL-1234567890abcdef' */ licenseKey: string; /** * New Relic region for ingest API endpoints. * Determines whether to use `newrelic.com` (US) or `eu.newrelic.com` (EU). * * @default 'us' */ region?: NewRelicRegion; /** * Which ingest APIs to send data to. * * @default 'both' */ mode?: NewRelicMode; /** * Common attributes attached to every log entry and metric payload. * Useful for environment, service name, version, etc. * * @example { environment: 'production', service: 'myapp' } */ commonAttributes?: Record; /** * Prefix prepended to event names to form metric names. * Event `purchase` with prefix `custom.` → metric name `custom.purchase`. * * @default 'custom.' */ metricPrefix?: string; /** * When `true`, `userId`, `anonymousId`, and `sessionId` are included as * metric attributes. Disabled by default because these are high-cardinality * and can exhaust New Relic's cardinality limits (3M-10M unique series). * * These IDs are always included in log entries (logs have no cardinality limit). * * @default false */ includeUserIdsInMetrics?: boolean; } interface MytartConfig { providers: ProviderConfig[]; defaultUserId?: string; defaultAnonymousId?: string; defaultSessionId?: string; /** * When `true`, activates debug mode globally: * * 1. **Cascades to all providers** — each provider behaves as if its own * `debug` flag is `true` (e.g. GA4 DebugView, Snapchat `/validate` * endpoint, Google Ads `validate_only`). Provider-level `debug` settings * take precedence if explicitly set. * 2. **Enriches `TrackResult`** — every server-mode result includes a * `debugInfo` object containing the request payload sent, the full * response body received, response headers, timing, and any validation * errors. This makes integration issues visible instead of silent. * * Defaults to `false`. */ debug?: boolean; /** * When `true`, silently drops all `track`, `identify`, and `page` calls * if the visitor's User-Agent belongs to a known bot or crawler. * * Detection uses `isBot()` from `ua-parser-js`. The User-Agent is read * from `context.userAgent` (if supplied) or `navigator.userAgent` in * browser environments. * * Defaults to `false` (bots are tracked like any other visitor). */ ignoreBots?: boolean; /** * When `true`, automatically captures click IDs from URL parameters * (`gclid`, `fbclid`, `ttclid`, `msclkid`, `li_fat_id`) and analytics * cookies (`_fbp`, `_fbc`, `_ga`) at construction time, then injects * them as `xpl_`-prefixed properties into every `track()`, `page()`, * and `identify()` call. * * This enables cross-provider attribution — e.g. linking a Meta ad * click to a Clarity session recording or a Mixpanel event — without * any manual wiring. * * Browser-only. SSR-safe (no-op when `window` is undefined). * Defaults to `false`. */ crossProviderLinking?: boolean; /** * When `true`, uses ThumbmarkJS to generate a stable browser fingerprint * and sets it as the `anonymousId` in state. This provides a consistent * device identifier across sessions without cookies. * * The fingerprint is resolved lazily on the first `track()`, `identify()`, * or `page()` call. It only sets `anonymousId` when no explicit value has * been provided (via `defaultAnonymousId`, `setAnonymousId()`, or per-call * `anonymousId`). * * Requires `@thumbmarkjs/thumbmarkjs` to be installed as a dependency. * Browser-only. SSR-safe (no-op when `window` is undefined). * Defaults to `true`. */ browserFingerprint?: boolean; /** * Global convenience flag to auto-configure consent across all providers * that support consent management (currently Google Analytics and Meta Pixel). * * - `true` — all consent categories are granted at provider initialisation * time. For GA this emits `gtag('consent', 'default', { ... all granted })` * before `gtag('js')`; for Meta Pixel it calls `fbq('consent', 'grant')` * after `fbq('init')`. Use this when you have user consent at page load. * - `false` — all consent categories are denied / revoked at provider * initialisation time. You can grant consent later at runtime via * `mytart.updateConsent()`. * - `undefined` (default) — no automatic consent calls; each provider's * own defaults apply. * * Provider-level consent config always takes precedence: if a GA provider * has `defaultConsent` or `signals` set, those win over this global flag. * * Browser-only — consent is a no-op in server mode. */ consent?: boolean; /** * Global retry configuration for all server-mode HTTP calls. * When set, failed requests that match retryable status codes (default: * 429, 500, 502, 503, 504) or network errors are automatically retried * with exponential backoff + jitter. * * Pass `{}` for sensible defaults (3 retries, 1s base delay, 30s max). * Omit or set to `undefined` to disable retries (single attempt). */ retry?: RetryConfig; /** * Called whenever a failed event is added to the dead-letter queue. * Use this to persist failures to your own store (database, file, SQS, etc.) * so they survive process restarts. */ onDeadLetter?: (event: DeadLetterEvent) => void; /** * Maximum number of events to keep in the in-memory dead-letter queue. * When the queue is full, the oldest entry is evicted. * Default: 1000. */ deadLetterMaxSize?: number; } /** * Central state managed by Mytart that can be accessed by all providers. * This enables providers to share state (userId, anonymousId, sessionId) * without coupling to each other. */ interface MytartState { userId: string | undefined; anonymousId: string | undefined; sessionId: string | undefined; /** The stable fingerprint ID (ThumbmarkJS hash). Only set when `browserFingerprint: true` and no explicit `anonymousId` was provided. Same value as `anonymousId` in that case. */ fingerprintId?: string; /** Full ThumbmarkJS response — available after first track/identify/page call when `browserFingerprint: true`. */ fingerprintData?: _thumbmarkjs_thumbmarkjs.ThumbmarkResponse; } interface EventContext { /** Deduplication ID for the event. Forwarded to providers that support it. */ eventId?: string; ip?: string; userAgent?: string; locale?: string; page?: { url?: string; title?: string; referrer?: string; }; [key: string]: unknown; } interface UserTraits { email?: string; phone?: string; first_name?: string; last_name?: string; name?: string; gender?: 'male' | 'female'; city?: string; country?: string; country_code?: string; region?: string; state?: string; postal_code?: string; address?: string; company?: string; avatar?: string; bio?: string; age?: number; birthday?: string; } interface IdentifyOptions { userId?: string; traits?: UserTraits & Partial & Record; anonymousId?: string; sessionId?: string; timestamp?: Date; context?: EventContext; /** * Route this call only to providers belonging to the specified group(s). * When omitted, all enabled providers receive the call (default behaviour). * Providers with no `group` assigned are excluded when `groups` is set. */ groups?: ProviderGroup[]; } interface PageOptions { name?: string; url: string; referrer?: string; /** * Event properties. Cross-provider linking properties are merged first, then user-defined * properties are merged on top (user properties take precedence). * * This type intersection enforces the correct merge order: `CrossProviderLinkingProperties` * (base) + user properties (override). TypeScript treats the left operand of `&` as the base. */ properties?: Partial & Record; /** * User traits cached from a prior `identify()` call. Automatically merged * by Mytart — you do NOT need to pass this manually. */ traits?: Record; userId?: string; anonymousId?: string; sessionId?: string; timestamp?: Date; context?: EventContext; /** * Route this call only to providers belonging to the specified group(s). * When omitted, all enabled providers receive the call (default behaviour). * Providers with no `group` assigned are excluded when `groups` is set. */ groups?: ProviderGroup[]; } interface TrackResult { provider: string; success: boolean; statusCode?: number; error?: MytartError; /** Number of HTTP attempts made (including retries). */ attempts?: number; /** Whether this error type was retryable (429/5xx/network). */ retryable?: boolean; /** Total wall-clock time in ms, including retries. */ duration?: number; /** Populated when debug mode is enabled. */ debugInfo?: DebugInfo; } interface DebugInfo { requestUrl?: string; requestMethod?: string; requestPayload?: unknown; requestHeaders?: Record; responseBody?: unknown; responseHeaders?: Record; responseStatus?: number; duration?: number; validationErrors?: string[]; } interface MytartError { message: string; code: string; provider: string; originalError?: unknown; } /** * Configuration for the automatic retry mechanism. * Applied globally to all server-mode HTTP calls via an axios interceptor. */ interface RetryConfig { /** Maximum number of retry attempts after the initial request. Default: 3 */ maxRetries?: number; /** Base delay in ms for exponential backoff. Default: 1000 */ baseDelay?: number; /** Maximum delay in ms (caps the backoff). Default: 30000 */ maxDelay?: number; /** HTTP status codes that trigger a retry. Default: [429, 500, 502, 503, 504] */ retryableStatusCodes?: number[]; } /** * An event that exhausted all retries and was placed in the dead-letter queue. */ interface DeadLetterEvent { /** Unique identifier for this DLQ entry. */ id: string; /** Epoch ms when the failure was recorded. */ timestamp: number; /** Which provider failed. */ provider: string; /** Which method was called. */ method: 'track' | 'identify' | 'page'; /** The options object that was passed to the provider. */ options: TrackOptions | IdentifyOptions | PageOptions; /** The failed TrackResult with error details. */ result: TrackResult; } /** * Result of replaying a single dead-letter event. */ interface ReplayResult { /** The DLQ entry ID that was replayed. */ deadLetterId: string; /** The new result from the replay attempt. */ result: TrackResult; } /** * Cross-provider identity linking. * * Captures click IDs from URL parameters and analytics cookies in the * browser, then converts them into a flat property map that can be * injected into every provider call. * * Browser-only — returns empty results when `window` is undefined. */ /** Identifiers captured from URL parameters and cookies. */ interface CapturedIds { /** Google click ID (`gclid` URL param) */ gclid?: string; /** Meta/Facebook click ID (`fbclid` URL param) */ fbclid?: string; /** TikTok click ID (`ttclid` URL param) */ ttclid?: string; /** Microsoft Ads click ID (`msclkid` URL param) */ msclkid?: string; /** LinkedIn click ID (`li_fat_id` URL param) */ li_fat_id?: string; /** Meta browser ID (from `_fbp` cookie) */ fbp?: string; /** Meta click ID cookie (from `_fbc` cookie, or synthesised from `fbclid`) */ fbc?: string; /** Google Analytics client ID (extracted from `_ga` cookie) */ gaClientId?: string; /** Snapchat click ID (`ScCid` URL param) */ sccid?: string; /** Snapchat cookie ID (from `_scid` cookie) */ sc_cookie1?: string; /** Twitter/X click ID (`twclid` URL param) */ twclid?: string; /** Pinterest click ID (from `_epik` cookie) */ epik?: string; } declare class Mytart { private readonly providers; private readonly config; private readonly capturedIds; private readonly linkingProperties; private readonly resolvedDefaultConsent; private readonly deadLetterQueue; private dlqCounter; private fingerprintPromise; private cachedTraits; private state; constructor(config: MytartConfig); /** * Returns `true` when `ignoreBots` is enabled and the given (or detected) * User-Agent belongs to a known bot or crawler. */ private isBotRequest; /** * Lazily resolves the browser fingerprint via ThumbmarkJS. The Promise is * created on first call and cached — subsequent calls return the same * Promise. SSR-safe: returns `undefined` when `window` is not available. */ private resolveFingerprint; /** * Ensures the browser fingerprint has been resolved and stored in state * as `anonymousId` and `fingerprintData` (only when no explicit * `anonymousId` has been set). * Called at the top of `track()`, `identify()`, and `page()` before * state enrichment. */ private ensureFingerprint; /** * Returns the subset of providers that match the requested groups. * When `groups` is undefined/empty, all providers are returned (default). * When `groups` is specified, only providers whose group(s) intersect are * returned; ungrouped providers are excluded. */ private filterByGroups; /** * Track an event with a standard event name. * Provides typed properties based on the event. */ track(options: { event: E; properties?: StandardEventProperties[E]; userId?: string; anonymousId?: string; sessionId?: string; timestamp?: Date; context?: EventContext; orderId?: string; value?: number; currency?: string; groups?: ProviderGroup[]; } & CrossProviderLinkingProperties): Promise; /** * Track an event with a custom event name. */ track(options: TrackOptions): Promise; identify(options: IdentifyOptions): Promise; page(options: PageOptions): Promise; /** * Update consent state across all providers that support consent management. * Currently this is meaningful for Google Analytics (Consent Mode v2) in * browser mode. Call this when the user interacts with a cookie/consent * banner. * * To enable Google Signals demographics (age, gender, interests), grant * at least `ad_personalization` and `ad_user_data`. */ updateConsent(consent: ConsentSettings): Promise; addProvider(config: ProviderConfig): void; removeProvider(name: string): void; getProviders(): string[]; /** * Returns the click IDs and cookie values captured at construction * time, or `null` when `crossProviderLinking` is disabled. */ getCapturedIds(): CapturedIds | null; /** * Get the current state. */ getState(): MytartState; /** * Returns the fingerprint ID (ThumbmarkJS hash) if available. * Requires `browserFingerprint: true` (default) and that at least one * `track()`, `identify()`, or `page()` call has been made. * Returns `undefined` if no fingerprint has been resolved. */ getFingerprintId(): string | undefined; /** * Returns cached user traits from prior `identify()` calls. * Traits are merged across multiple identify calls and persist * until `clearState()` is called. */ getTraits(): Record; /** * Returns the resolved default consent settings derived from the global * `consent` flag, or `null` when the flag is not set. */ getDefaultConsent(): ConsentSettings | null; /** * Returns the global retry config, or `undefined` when retries are disabled. */ getRetryConfig(): RetryConfig | undefined; /** * Returns `true` when global debug mode is enabled. */ getDebug(): boolean; /** * Add a failed event to the in-memory dead-letter queue. * If the queue exceeds `deadLetterMaxSize`, the oldest entry is evicted. * Calls the `onDeadLetter` callback if configured. */ private addToDeadLetterQueue; /** * Returns a shallow copy of the current dead-letter queue. */ getDeadLetterQueue(): DeadLetterEvent[]; /** * Replays all events in the dead-letter queue by re-dispatching them to * the appropriate provider. Events that succeed are removed from the queue; * events that fail again remain. * * Returns one `ReplayResult` per DLQ entry. */ replayDeadLetterQueue(): Promise; /** * Clears all entries from the in-memory dead-letter queue. */ clearDeadLetterQueue(): void; /** * Set userId in state. Use this when a user logs in. */ setUserId(userId: string): void; /** * Set anonymousId in state. Use this to identify anonymous users. */ setAnonymousId(anonymousId: string): void; /** * Set sessionId in state. Use this when a new session starts. */ setSessionId(sessionId: string): void; /** * Clear userId (e.g., on logout). */ clearUserId(): void; /** * Clear all state (userId, anonymousId, sessionId). * Use this to reset state entirely. */ clearState(): void; /** * Clear sessionId only (e.g., when session expires). */ clearSessionId(): void; } interface MytartLike { getState(): MytartState; /** * Returns the resolved default consent settings derived from the global * `consent` flag on `MytartConfig`, or `null` when the flag is not set. * Providers use this during their own initialisation to set consent at the * correct point in their init flow. */ getDefaultConsent(): ConsentSettings | null; /** Returns the global retry config, or `undefined` when retries are disabled. */ getRetryConfig(): RetryConfig | undefined; /** Returns `true` when global debug mode is enabled. */ getDebug(): boolean; setUserId(userId: string): void; setAnonymousId(anonymousId: string): void; setSessionId(sessionId: string): void; clearUserId(): void; clearSessionId(): void; clearState(): void; } declare abstract class BaseProvider { abstract readonly name: string; protected readonly mytart: MytartLike; /** Groups this provider belongs to (empty array = ungrouped). */ readonly groups: ProviderGroup[]; constructor(mytart: MytartLike, groups?: ProviderGroup | ProviderGroup[]); abstract track(options: TrackOptions): Promise; abstract identify(options: IdentifyOptions): Promise; abstract page(options: PageOptions): Promise; /** * Update consent state. Only meaningful for providers that support consent * management (e.g. Google Analytics Consent Mode v2). Default is a no-op. */ updateConsent(_consent: ConsentSettings): Promise; /** * Returns `true` when debug mode is active for this provider. Provider-level * `config.debug` takes precedence; when it is `undefined` the global * `MytartConfig.debug` flag is used as a fallback. * * Subclasses that have a `config.debug` property should call this instead of * reading `this.config.debug` directly so that the global cascade works. */ protected isDebug(providerDebug?: boolean): boolean; /** * Create an HTTP client pre-configured with the global retry and debug * settings from `MytartConfig`. Call this in provider constructors * instead of the raw `createHttpClient()`. */ protected createHttp(): AxiosInstance; /** * Execute an HTTP request with standardised error handling and metadata * extraction. Replaces the manual try/catch + buildError/buildSuccess * boilerplate in every server-mode method. * * @param request A thunk that performs the actual HTTP call. * @param errorPrefix Provider prefix for error codes (e.g. `'TIKTOK'`). */ protected executeRequest(request: () => Promise, errorPrefix: string): Promise; protected buildError(message: string, code: string, originalError?: unknown): TrackResult; protected buildSuccess(statusCode?: number): TrackResult; } declare global { interface Window { gtag: GtagFn$1; dataLayer: unknown[]; } } type GtagFn$1 = (...args: unknown[]) => void; declare class GoogleAnalyticsProvider extends BaseProvider { readonly name = "google-analytics"; private readonly config; private readonly http; private readonly endpoint; private readonly isBrowser; private gtagReady; constructor(config: GoogleAnalyticsConfig, mytart: MytartLike); /** * Initializes the gtag.js snippet exactly as Google's official documentation * specifies. This mirrors the standard snippet: * * * * * When `defaultConsent` is configured, a `gtag('consent', 'default', ...)` * call is emitted **before** `gtag('js')` and `gtag('config')`, as required * by Google's Consent Mode v2 specification. * * Key details: * - The script URL MUST include ?id=TAG_ID for Google Tag Tester detection * - dataLayer and the gtag shim are set up BEFORE the script loads * - gtag('js') and gtag('config') are called synchronously — they queue * into dataLayer and are processed once the real script loads * - The returned promise resolves when the script finishes loading */ private initGtag; /** * Ensures gtag is initialized exactly once. Subsequent calls return the * same promise so the script is never injected twice. */ private ensureGtag; private mapEventName; private trackBrowser; private identifyBrowser; private pageBrowser; private buildGtagResult; /** * Updates the consent state at runtime. In browser mode this emits * `gtag('consent', 'update', ...)`. Call this when the user interacts * with a cookie/consent banner. * * To enable Google Signals demographics (age, gender, interests), grant * at least `ad_personalization` and `ad_user_data`. * * In server mode this is a no-op — the Measurement Protocol does not * support Consent Mode. */ updateConsent(consent: ConsentSettings): Promise; /** * Checks if an event is a betting/iGaming event. */ private isBettingEvent; /** * Applies property mappings for betting events. * Merges user-provided mappings with default provider mappings. */ private applyPropertyMappings; track({ event, properties, userId, anonymousId, sessionId, timestamp }: TrackOptions): Promise; identify({ userId, anonymousId, traits, sessionId }: IdentifyOptions): Promise; page({ name, url, referrer, userId, anonymousId, sessionId }: PageOptions): Promise; } declare global { interface Window { gtag: GtagFn; dataLayer: unknown[]; } } type GtagFn = (...args: unknown[]) => void; /** * Google Ads provider supporting both browser (gtag.js) and server * (Google Ads API for Enhanced Conversions) modes. * * Browser mode uses the same gtag.js as GA4 but fires conversion events * with `gtag('event', 'conversion', { send_to: conversionActionId })`. * * Server mode uses the Google Ads API to upload ClickConversion objects * with hashed user identifiers for enhanced matching. */ declare class GoogleAdsProvider extends BaseProvider { readonly name = "google-ads"; private readonly config; private readonly http; private readonly isBrowser; private readonly apiVersion; private gtagReady; private cachedUserIdentifier; constructor(config: GoogleAdsConfig, mytart: MytartLike); private mapEventName; /** * Initializes gtag.js for Google Ads conversion tracking. * This is similar to GA4 but focuses on conversion events. * * Note: If GA4 is also configured, gtag is already loaded with the same script. * This method is idempotent and safe to call multiple times. */ private initGtag; private ensureGtag; /** * Extracts the Google Ads account ID from the conversion action ID. * Format: AW-XXXXXXXXXX/XXXXXXXXXX */ private extractAccountId; private trackBrowser; private identifyBrowser; private pageBrowser; private buildGtagResult; /** * Normalizes and hashes an email address for enhanced conversions. * - Lowercase the entire email * - For Gmail/Googlemail: remove '.' and '+' suffix from username */ private normalizeAndHashEmail; /** * Normalizes and hashes a phone number for enhanced conversions. * Converts to E.164 format (+CCNNNNNNNN) and hashes. */ private normalizeAndHashPhone; /** * Builds user_identifiers array for the Google Ads API. * Up to 5 identifiers can be included per conversion. */ private buildUserIdentifiers; private trackServer; private identifyServer; private pageServer; track(options: TrackOptions): Promise; identify(options: IdentifyOptions): Promise; page(options: PageOptions): Promise; } declare class MixpanelProvider extends BaseProvider { readonly name = "mixpanel"; private readonly config; private readonly http; constructor(config: MixpanelConfig, mytart: MytartLike); private encodeData; private mapEventName; track({ event, properties, userId, anonymousId, sessionId, timestamp }: TrackOptions): Promise; identify({ userId, anonymousId, traits, sessionId }: IdentifyOptions): Promise; page({ name, url, userId, anonymousId, sessionId, properties }: PageOptions): Promise; } declare class SegmentProvider extends BaseProvider { readonly name = "segment"; private readonly config; private readonly http; private readonly baseUrl; constructor(config: SegmentConfig, mytart: MytartLike); private getAuth; track({ event, properties, userId, anonymousId, sessionId, timestamp, context }: TrackOptions): Promise; identify({ userId, traits, anonymousId, sessionId, timestamp }: IdentifyOptions): Promise; page({ name, url, referrer, properties, userId, anonymousId, sessionId, timestamp }: PageOptions): Promise; } declare class AmplitudeProvider extends BaseProvider { readonly name = "amplitude"; private readonly config; private readonly http; private readonly endpoint; constructor(config: AmplitudeConfig, mytart: MytartLike); private mapEventName; track({ event, properties, userId, anonymousId, sessionId, timestamp }: TrackOptions): Promise; identify({ userId, traits, anonymousId, sessionId }: IdentifyOptions): Promise; page({ name, url, userId, anonymousId, sessionId, properties }: PageOptions): Promise; } declare class PlausibleProvider extends BaseProvider { readonly name = "plausible"; private readonly config; private readonly http; private readonly endpoint; constructor(config: PlausibleConfig, mytart: MytartLike); private buildHeaders; track({ event, properties, context }: TrackOptions): Promise; identify(_options: IdentifyOptions): Promise; page({ name, url, referrer, properties }: PageOptions): Promise; } declare class PostHogProvider extends BaseProvider { readonly name = "posthog"; private readonly config; private readonly http; private readonly endpoint; constructor(config: PostHogConfig, mytart: MytartLike); track({ event, properties, userId, anonymousId, sessionId, timestamp }: TrackOptions): Promise; identify({ userId, traits, anonymousId, sessionId }: IdentifyOptions): Promise; page({ name, url, userId, anonymousId, sessionId, properties }: PageOptions): Promise; } declare global { interface Window { fbq: FbqFn & { callMethod?: FbqFn; queue?: unknown[]; loaded?: boolean; version?: string; push?: FbqFn; }; _fbq: Window['fbq']; } } type FbqFn = (...args: unknown[]) => void; declare class MetaPixelProvider extends BaseProvider { readonly name = "meta-pixel"; private readonly config; private readonly http; private readonly isBrowser; private readonly apiVersion; private fbqReady; private cachedUserData; constructor(config: MetaPixelConfig, mytart: MytartLike); private mapEventName; /** * Checks if an event is a betting/iGaming event. */ private isBettingEvent; /** * Applies property mappings for betting events. * Merges user-provided mappings with default provider mappings. */ private applyPropertyMappings; /** * Initialises the Meta Pixel snippet. This mirrors the official snippet from * https://developers.facebook.com/docs/meta-pixel/get-started: * * !function(f,b,e,v,n,t,s){...}(window, document,'script', * 'https://connect.facebook.net/en_US/fbevents.js'); * fbq('init', 'PIXEL_ID'); * fbq('track', 'PageView'); * * Key details: * - The fbq shim queue is set up synchronously before the script loads * - `fbq('init', pixelId, advancedMatching?)` is called immediately * - autoConfig is respected via `fbq('set', 'autoConfig', false, pixelId)` * - debug mode via `fbq('set', 'debug', true)` * - The returned promise resolves when the script finishes loading */ private initFbq; /** * Ensures the Pixel is initialised exactly once. Subsequent calls return * the same promise so the script is never injected twice. */ private ensureFbq; private trackBrowser; private identifyBrowser; private pageBrowser; private buildFbqResult; private get capiEndpoint(); /** * Build the `user_data` object for a CAPI event. * Merges cached user data (from `identify()` / config) with any per-event * overrides, then SHA-256 hashes known PII fields. */ private buildUserData; private trackServer; private identifyServer; private pageServer; /** * Override of BaseProvider.updateConsent() to bridge the standard * ConsentSettings interface to Meta Pixel's binary consent model. * * Meta Pixel only supports grant/revoke, so we derive the decision from * `ad_storage`: if `'granted'`, consent is granted; if `'denied'`, consent * is revoked. If `ad_storage` is not specified, this is a no-op. */ updateConsent(consent: ConsentSettings): Promise; /** * Grant or revoke consent for the Meta Pixel in browser mode. * Calls `fbq('consent', 'grant')` or `fbq('consent', 'revoke')`. */ updatePixelConsent(granted: boolean): Promise; track(options: TrackOptions): Promise; identify(options: IdentifyOptions): Promise; page(options: PageOptions): Promise; } declare global { interface Window { clarity: ClarityFn & { q?: unknown[][]; }; } } type ClarityFn = (...args: unknown[]) => void; declare class ClarityProvider extends BaseProvider { readonly name = "clarity"; private readonly config; private clarityReady; constructor(config: ClarityConfig, mytart: MytartLike); /** * Injects the official Clarity tracking snippet. Mirrors: * * (function(c,l,a,r,i,t,y){ * c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)}; * t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i; * y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y); * })(window, document, "clarity", "script", "PROJECT_ID"); */ private initClarity; private ensureClarity; track(options: TrackOptions): Promise; identify(options: IdentifyOptions): Promise; page(options: PageOptions): Promise; } declare global { interface Window { hj: HjFn & { q?: unknown[][]; }; _hjSettings: { hjID: string; hjPID: number; hjLazyHotjar?: boolean; }; } } type HjFn = (...args: unknown[]) => void; declare class HotjarProvider extends BaseProvider { readonly name = "hotjar"; private readonly config; private hotjarReady; constructor(config: HotjarConfig, mytart: MytartLike); /** * Injects the official Hotjar tracking snippet. * * (function(h,o,t,j,a,r){ * h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)}; * a=o.createElement('script');o=o.getElementsByTagName('script')[0]; * a.async=1;a.src=t;o.parentNode.insertBefore(a,r); * })(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv='); */ private initHotjar; private ensureHotjar; track(options: TrackOptions): Promise; identify(options: IdentifyOptions): Promise; page(options: PageOptions): Promise; } declare global { interface Window { heap: HeapFn & { q?: unknown[][]; }; } } type HeapFn = (...args: unknown[]) => void; declare class HeapProvider extends BaseProvider { readonly name = "heap"; private readonly config; private readonly http; private readonly isBrowser; private heapReady; constructor(config: HeapConfig, mytart: MytartLike); /** * Injects the official Heap tracking snippet. * Uses the same pattern as Heap's official snippet. */ private initHeap; private ensureHeap; private trackBrowser; private identifyBrowser; private pageBrowser; private trackServer; private identifyServer; private pageServer; track(options: TrackOptions): Promise; identify(options: IdentifyOptions): Promise; page(options: PageOptions): Promise; } declare global { interface Window { ttq: TtqFn & { methods?: string[]; instance?: (id: string) => TtqFn; load?: (pixelCode: string) => void; page?: () => void; track?: (event: string, properties?: Record, options?: Record) => void; identify?: (data: Record) => void; _i?: unknown[]; _o?: Record; }; TiktokAnalyticsObject?: string; } } type TtqFn = (...args: unknown[]) => void; declare class TikTokProvider extends BaseProvider { readonly name = "tiktok"; private readonly config; private readonly http; private readonly isBrowser; private readonly apiVersion; private ttqReady; /** Cached user data from identify() for subsequent track/page calls (server mode). */ private cachedUserData; constructor(config: TikTokConfig, mytart: MytartLike); private mapEventName; /** * Checks if an event is a betting/iGaming event. */ private isBettingEvent; /** * Applies property mappings for betting events. * Merges user-provided mappings with default provider mappings. */ private applyPropertyMappings; /** * Initialises the TikTok Pixel snippet. This mirrors the official snippet: * * !function(w,d,t){...}(window, document, 'ttq'); * ttq.load('PIXEL_CODE'); * ttq.page(); * * Key details: * - The ttq shim queue is set up synchronously before the script loads * - `ttq.load(pixelCode)` is called immediately to register the pixel * - The returned promise resolves when the script finishes loading */ private initTtq; /** * Ensures the Pixel is initialised exactly once. Subsequent calls return * the same promise so the script is never injected twice. */ private ensureTtq; private trackBrowser; private identifyBrowser; private pageBrowser; private buildTtqResult; private get eventsApiEndpoint(); /** * Hash TikTok PII fields (email, phone_number, external_id). * TikTok requires SHA-256 for these fields; IP and user_agent are NOT hashed. */ private hashTikTokUserData; /** * Build the `user` object for a TikTok Events API event. * Merges cached user data with per-event overrides, then hashes PII fields. */ private buildUserData; private trackServer; private identifyServer; private pageServer; track(options: TrackOptions): Promise; identify(options: IdentifyOptions): Promise; page(options: PageOptions): Promise; } declare global { interface Window { snaptr: SnaptrFn & { handleRequest?: (...args: unknown[]) => void; queue?: unknown[][]; }; } } type SnaptrFn = (...args: unknown[]) => void; /** * Snapchat PII fields that must be SHA-256 hashed before sending to the * Conversions API. Uses the same short field names as Meta (em, ph, fn, ln, * ge, ct, st, zp, country). Fields NOT hashed: client_ip_address, * client_user_agent, external_id, sc_click_id, sc_cookie1, madid. * * We reuse `hashUserData()` from `src/utils/hash.ts` which handles exactly * these PII fields. */ declare class SnapchatProvider extends BaseProvider { readonly name = "snapchat"; private readonly config; private readonly http; private readonly isBrowser; private snaptrReady; /** Cached user data from identify() for subsequent track/page calls (server mode). */ private cachedUserData; constructor(config: SnapchatConfig, mytart: MytartLike); private mapEventName; /** * Initialises the Snap Pixel snippet. This mirrors the official snippet: * * (function(e,t,n){if(e.snaptr)return;var a=e.snaptr=function(){ * a.handleRequest?a.handleRequest.apply(a,arguments):a.queue.push(arguments) * };a.queue=[];...})(window,document,'https://sc-static.net/scevent.min.js'); * snaptr('init', 'PIXEL_ID', { 'user_email': '...' }); * snaptr('track', 'PAGE_VIEW'); */ private initSnaptr; /** * Ensures the Pixel is initialised exactly once. Subsequent calls return * the same promise so the script is never injected twice. */ private ensureSnaptr; private trackBrowser; private identifyBrowser; private pageBrowser; private buildSnaptrResult; private get eventsApiEndpoint(); /** * Build the `user_data` object for a Snapchat CAPI event. * Merges cached user data with per-event overrides, then hashes PII fields * using the shared `hashUserData()` utility (same PII field names as Meta: * em, ph, fn, ln, ge, ct, st, zp, country). */ private buildUserData; private trackServer; private identifyServer; private pageServer; track(options: TrackOptions): Promise; identify(options: IdentifyOptions): Promise; page(options: PageOptions): Promise; } declare global { interface Window { twq: TwqFn & { exe?: (...args: unknown[]) => void; version?: string; queue?: unknown[][]; }; } } type TwqFn = (...args: unknown[]) => void; declare class TwitterProvider extends BaseProvider { readonly name = "twitter"; private readonly config; private readonly http; private readonly isBrowser; private readonly apiVersion; private twqReady; /** Cached user data from identify() for subsequent track/page calls (server mode). */ private cachedUserData; constructor(config: TwitterConfig, mytart: MytartLike); private mapEventName; /** * Initialises the X Pixel snippet. This mirrors the official snippet: * * !function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){ * s.exe?s.exe.apply(s,arguments):s.queue.push(arguments) * },s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0, * u.src='https://static.ads-twitter.com/uwt.js', * a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))} * (window,document,'script'); * twq('config', PIXEL_ID); */ private initTwq; /** * Ensures the Pixel is initialised exactly once. Subsequent calls return * the same promise so the script is never injected twice. */ private ensureTwq; private trackBrowser; private identifyBrowser; private pageBrowser; private buildTwqResult; private get conversionsApiEndpoint(); /** * Hash Twitter PII fields for the Conversion API. * Twitter uses `hashed_email` and `hashed_phone_number` as field names. * `twclid`, `ip_address`, `user_agent` are NOT hashed. */ private buildIdentifiers; private trackServer; private identifyServer; private pageServer; track(options: TrackOptions): Promise; identify(options: IdentifyOptions): Promise; page(options: PageOptions): Promise; } declare global { interface Window { rdt: RdtFn & { sendEvent?: (...args: unknown[]) => void; callQueue?: unknown[][]; }; } } type RdtFn = (...args: unknown[]) => void; /** * Reddit Pixel (browser) + Conversions API (server) provider. * * Browser mode injects the official Reddit Pixel script * (`https://www.redditstatic.com/ads/pixel.js`) and calls `window.rdt()`. * * Server mode sends events to the Reddit Conversions API at * `https://ads-api.reddit.com/api/v2.0/conversions/events/{accountId}`. * * PII hashing: In server mode, `email` and `external_id` are SHA-256 * hashed before sending. `ip_address` and `user_agent` are NOT hashed. */ declare class RedditProvider extends BaseProvider { readonly name = "reddit"; private readonly config; private readonly http; private readonly isBrowser; private rdtReady; /** Cached user data from identify() for subsequent track/page calls (server mode). */ private cachedUserData; constructor(config: RedditConfig, mytart: MytartLike); private mapEventName; /** * Initialises the Reddit Pixel snippet. Mirrors the official snippet: * * !function(w,d){if(!w.rdt){var p=w.rdt=function(){ * p.sendEvent?p.sendEvent.apply(p,arguments):p.callQueue.push(arguments) * };p.callQueue=[];...}}(window,document); * rdt('init', 'PIXEL_ID', { optOut: false, useDecimalCurrencyValues: true }); * rdt('track', 'PageVisit'); */ private initRdt; /** * Ensures the Pixel is initialised exactly once. Subsequent calls return * the same promise so the script is never injected twice. */ private ensureRdt; private trackBrowser; private identifyBrowser; private pageBrowser; private buildRdtResult; private get conversionsApiEndpoint(); /** * Build the `user` object for a Reddit CAPI event. * Merges cached user data with per-event overrides, then hashes PII fields. * Reddit requires SHA-256 hashing for `email` and `external_id`. * `ip_address` and `user_agent` are NOT hashed. */ private hashRedditUserData; private trackServer; private identifyServer; private pageServer; track(options: TrackOptions): Promise; identify(options: IdentifyOptions): Promise; page(options: PageOptions): Promise; } declare global { interface Window { pintrk: PintrkFn & { queue?: unknown[][]; version?: string; }; } } type PintrkFn = (...args: unknown[]) => void; /** * Pinterest Tag (browser) + Conversions API v5 (server) provider. * * Browser mode injects the official Pinterest Tag script * (`https://s.pinimg.com/ct/core.js`) and calls `window.pintrk()`. * * Server mode sends events to the Pinterest Conversions API at * `https://api.pinterest.com/v5/ad_accounts/{adAccountId}/events`. * * PII hashing: In server mode, PII fields (`em`, `ph`, `fn`, `ln`, `ge`, * `db`, `ct`, `st`, `zp`, `country`) and `external_id` are SHA-256 hashed. * All hashed values are wrapped in arrays per Pinterest's specification. * `client_ip_address` and `client_user_agent` are NOT hashed. */ declare class PinterestProvider extends BaseProvider { readonly name = "pinterest"; private readonly config; private readonly http; private readonly isBrowser; private pintrkReady; /** Cached user data from identify() for subsequent track/page calls (server mode). */ private cachedUserData; constructor(config: PinterestConfig, mytart: MytartLike); private mapEventName; /** * Convert a CAPI snake_case event name to the browser pixel's * concatenated-lowercase form. Unknown names pass through as-is. */ private toBrowserEventName; /** * Initialises the Pinterest Tag snippet. Mirrors the official snippet: * * !function(e){if(!window.pintrk){window.pintrk=function(){ * window.pintrk.queue.push(Array.prototype.slice.call(arguments)) * };var n=window.pintrk;n.queue=[],n.version="3.0";... * }}(); * pintrk('load', 'TAG_ID', { em: '' }); * pintrk('page'); */ private initPintrk; /** * Ensures the Tag is initialised exactly once. Subsequent calls return * the same promise so the script is never injected twice. */ private ensurePintrk; private trackBrowser; private identifyBrowser; private pageBrowser; private buildPintrkResult; private get eventsApiEndpoint(); /** * Build the `user_data` object for a Pinterest CAPI event. * Merges cached user data with per-event overrides, hashes PII fields using * `hashUserData()`, then wraps all hashed PII values in arrays per Pinterest spec. * Also hashes and wraps `external_id`. * `client_ip_address`, `client_user_agent`, and `click_id` are NOT hashed/wrapped. */ private buildUserData; private trackServer; private identifyServer; private pageServer; track(options: TrackOptions): Promise; identify(options: IdentifyOptions): Promise; page(options: PageOptions): Promise; } declare global { interface Window { uetq: unknown[]; UET?: new (config: Record) => { push: (...args: unknown[]) => void; }; } } /** * Microsoft Advertising (Bing Ads) UET provider. * * Browser mode injects the official UET tag script * (`https://bat.bing.com/bat.js`) and pushes events via `window.uetq`. * * Server mode uploads offline conversions via the Microsoft Advertising * Campaign Management API at * `https://campaign.api.bingads.microsoft.com/CampaignManagement/v13/OfflineConversions/Apply`. * * PII hashing: In server mode, email and phone are SHA-256 hashed for * Enhanced Conversions matching. In browser mode, Enhanced Conversions use * `uetq.push('set', { pid: { em, ph } })` with pre-hashed values. */ declare class MicrosoftAdsProvider extends BaseProvider { readonly name = "microsoft-ads"; private readonly config; private readonly http; private readonly isBrowser; private uetqReady; /** Cached user data from identify() for subsequent track calls (server mode). */ private cachedUserData; constructor(config: MicrosoftAdsConfig, mytart: MytartLike); private mapEventName; /** * Initialises the UET tag snippet. Mirrors the official snippet: * * (function(w,d,t,r,u){ * w[u]=w[u]||[]; * var f=function(){ * var o={ti:"TAG_ID"};o.q=w[u];w[u]=new UET(o);w[u].push("pageLoad"); * }; * var n=d.createElement(t);n.src=r;n.async=1; * n.onload=n.onreadystatechange=function(){...f()...}; * i=d.getElementsByTagName(t)[0];i.parentNode.insertBefore(n,i); * })(window,document,"script","//bat.bing.com/bat.js","uetq"); */ private initUetq; /** * Ensures the UET tag is initialised exactly once. Subsequent calls return * the same promise so the script is never injected twice. */ private ensureUetq; private trackBrowser; private identifyBrowser; private pageBrowser; private buildUetResult; /** * Build an OfflineConversion object for the API payload. * Hashes PII fields (email, phone) with SHA-256 for Enhanced Conversions. */ private buildConversion; private trackServer; private identifyServer; private pageServer; track(options: TrackOptions): Promise; identify(options: IdentifyOptions): Promise; page(options: PageOptions): Promise; } declare class NewRelicProvider extends BaseProvider { readonly name = "newrelic"; private readonly config; private readonly logUrl; private readonly metricUrl; private readonly apiKeyHeader; constructor(config: NewRelicConfig, mytart: MytartLike); track(options: TrackOptions): Promise; private trackLog; private trackMetric; identify(options: IdentifyOptions): Promise; page(options: PageOptions): Promise; private pageLog; private pageMetric; } export { type AmplitudeConfig, type AmplitudeEventMapping, AmplitudeProvider, BaseProvider, type BaseProviderConfig, type BetCancelledEventProperties, type BetPlacedEventProperties, type BetSettledEventProperties, type BettingEventPropertyMapping, type CapturedIds, type CartEventProperties, type CheckoutEventProperties, type ClarityConfig, ClarityProvider, type ConsentSettings, type ConsentState, type ContactEventProperties, type CrossProviderLinkingProperties, type DeadLetterEvent, type DebugInfo, type DepositEventProperties, type DonateEventProperties, type EventContext, type EventTaxonomyConfig, type FirstBetEventProperties, type GA4EventMapping, type GA4EventName, type GoogleAdsAppType, type GoogleAdsConfig, type GoogleAdsEventMapping, type GoogleAdsEventName, GoogleAdsProvider, type GoogleAdsUserIdentifier, type GoogleAnalyticsAppType, type GoogleAnalyticsConfig, GoogleAnalyticsProvider, type HeapAppType, type HeapConfig, HeapProvider, type HotjarConfig, HotjarProvider, type IdentifyOptions, type InplayUpdateEventProperties, type ItemListEventProperties, type LeadEventProperties, type LoginEventProperties, type MetaPixelAdvancedMatching, type MetaPixelAppType, type MetaPixelConfig, type MetaPixelEventMapping, type MetaPixelEventName, MetaPixelProvider, type MicrosoftAdsAppType, type MicrosoftAdsConfig, type MicrosoftAdsEventMapping, type MicrosoftAdsEventName, MicrosoftAdsProvider, type MixpanelConfig, type MixpanelEventMapping, type MixpanelEventName, MixpanelProvider, Mytart, type MytartConfig, type MytartError, type MytartLike, type MytartState, type NewRelicConfig, type NewRelicLogEntry, type NewRelicLogPayload, type NewRelicMetricEntry, type NewRelicMetricPayload, type NewRelicMode, NewRelicProvider, type NewRelicRegion, type PageOptions, type PageViewEventProperties, type PaymentShippingEventProperties, type PinterestAppType, type PinterestConfig, type PinterestEventMapping, type PinterestEventName, PinterestProvider, type PlausibleConfig, PlausibleProvider, type PostHogConfig, PostHogProvider, type PromotionEventProperties, type ProviderConfig, type ProviderGroup, type ProviderName, type PurchaseEventProperties, type RedditAppType, type RedditConfig, type RedditEventMapping, type RedditEventName, RedditProvider, type ReplayResult, type ResponsibleGamblingAlertEventProperties, type RetryConfig, STANDARD_EVENT_NAMES, type SearchEventProperties, type SegmentConfig, SegmentProvider, type SessionTimeoutEventProperties, type ShareEventProperties, type SignUpEventProperties, type SnapchatAppType, type SnapchatConfig, type SnapchatEventMapping, type SnapchatEventName, SnapchatProvider, type StandardEventName, type StandardEventProperties, type StandardItem, type SubscriptionEventProperties, type TikTokAppType, type TikTokConfig, type TikTokEventMapping, type TikTokEventName, TikTokProvider, type TrackOptions, type TrackResult, type TwitterAppType, type TwitterConfig, type TwitterEventMapping, type TwitterEventName, TwitterProvider, type TypedTrackOptions, type UserTraits, type WebhookConfig, type WithdrawalEventProperties };