Skip to main content

TrackEventProps

Upgather Analytics


Upgather Analytics / TrackEventProps

Interface: TrackEventProps

Properties required to track an analytics event.

Remarks

This interface is the primary input type for all event tracking functions. It combines an event identifier, metric type, organization ID, and payload to form a complete analytics event that can be tracked through the system.

The SDK will automatically:

  • Generate a timestamp if not provided in the payload
  • Generate a sessionId if not provided in the payload
  • Flatten the payload fields into the request body (no nested payload object)

Example

import { TrackEventProps, MetricType } from '@upgather/analytics';

const event: TrackEventProps = {
eventId: 'aitalks26',
organizationId: 'org-123',
metricType: MetricType.pageview,
payload: {
url: 'https://app.upgather.com/agenda',
referrer: 'https://google.com',
userId: 'user-456'
}
};

Properties

eventId

eventId: string

Identifier for the conference or event being tracked.

Remarks

The eventId represents the specific conference, event, or gathering (e.g., 'aitalks26', 'fedtalks2023') that the analytics are being tracked for, not the action being performed.

This ID will be included in all analytics data for this event, allowing for easy filtering and reporting by conference or event.

The eventId should be alphanumeric and can include hyphens, but should not include spaces, underscores, or other special characters.

Example

'aitalks26', 'fedtalks2023', 'tech-summit-fall'

metricType

metricType: MetricType

Type of metric being tracked.

Remarks

Must be one of the predefined enum values from MetricType. This categorizes the event for processing and reporting.

See

MetricType for available metric types


organizationId

organizationId: string

Organization identifier (REQUIRED).

Remarks

Used to identify the organization associated with the event. This field is required by the analytics service API. If not provided, trackEvent will throw an error.

Example

'org-upgather-123', 'org-scoop-456'

payload

payload: MetricPayload

Event payload containing event-specific data.

Remarks

Must include at minimum a 'url' property, plus any additional event-specific data relevant to the metric being tracked.

Optional fields in the payload:

  • timestamp: Unix timestamp in milliseconds (auto-generated if not provided)
  • sessionId: Session identifier (auto-generated if not provided)
  • userId: User identifier
  • userName: User display name
  • pageKey: Page identifier for pageview events
  • videoId: Video identifier for video_view events
  • boothId: Booth identifier for booth_visit events
  • UTM parameters: utmSource, utmMedium, utmCampaign, utmTerm, utmContent

See

MetricPayload for payload structure