InternalCreates a new EventBuilder instance.
Configuration used to customize event payloads.
Optional InternalappApplication metadata attached to each event.
Name of the application.
Version of the application.
InternalchannelChannel value attached to each event.
InternalgetFunction that provides the locale when available.
InternalgetFunction that provides baseline page properties.
InternalgetFunction that provides the user agent string when available.
InternallibraryLibrary metadata attached to each event.
Name of the SDK/library (e.g., "@contentful/optimization-web").
Version of the analytics library.
Builds a component view event payload for a Contentful entry-based component.
ComponentViewBuilderArgs arguments describing the component view.
A ComponentViewEvent describing the view.
Channel from which the event originated.
Contentful entry ID corresponding to the component that was viewed.
Type of component that was viewed.
'Entry' — A content entry component.'Variable' — A variable or inline value component.Context object carrying environment and client metadata.
Optionalapp?: { name: string; version: string }Application-level metadata.
Name of the application.
Version of the application.
Campaign attribution metadata.
Optionalcontent?: stringCampaign content (e.g., utm_content).
Optionalmedium?: stringCampaign medium (e.g., utm_medium).
Optionalname?: stringName of the campaign (e.g., utm_campaign).
Optionalsource?: stringCampaign source (e.g., utm_source).
Optionalterm?: stringCampaign term (e.g., utm_term).
GDPR-related consent information.
Indicates whether the user has given consent.
Analytics library metadata.
Name of the SDK/library (e.g., "@contentful/optimization-web").
Version of the analytics library.
Locale identifier of the event (e.g., "en-US").
Optionallocation?: {Optional geo-location information associated with the event.
Optionalcity?: stringCity name associated with the location.
Optionalcontinent?: stringContinent name associated with the location.
Optionalcoordinates?: { latitude: number; longitude: number }Geographical coordinates for the location.
Latitude component of the coordinates.
Longitude component of the coordinates.
Optionalcountry?: stringCountry name associated with the location.
OptionalcountryCode?: stringCountry code associated with the location.
OptionalpostalCode?: stringPostal or ZIP code associated with the location.
Optionalregion?: stringRegion or state name associated with the location.
OptionalregionCode?: stringRegion or state code associated with the location.
Optionaltimezone?: stringTime zone identifier associated with the location.
Optionalpage?: {Path component of the page URL (e.g., /products/123).
Parsed query parameters for the page.
Referrer URL that led to the current page.
Raw search string including the leading ? (e.g., "?q=test").
Optionaltitle?: stringTitle of the page as seen by the user.
Full URL of the page.
Optionalscreen?: { name: string; [key: string]: JSONType }Name or label for the screen.
OptionaluserAgent?: stringUser agent string of the client, if available.
OptionalexperienceId?: stringIdentifier of the experience that rendered this component.
Unique identifier for this message.
Timestamp when the event originally occurred.
Timestamp when the event payload was sent.
Timestamp when the event was recorded or processed.
Discriminator indicating that this event is a component view.
OptionaluserId?: stringIdentifier of the authenticated user, if known.
Index of the variant associated with this component view.
Builds a component view event payload for a Custom Flag component.
ComponentViewBuilderArgs arguments describing the Custom Flag view.
A ComponentViewEvent describing the view.
Channel from which the event originated.
Contentful entry ID corresponding to the component that was viewed.
Type of component that was viewed.
'Entry' — A content entry component.'Variable' — A variable or inline value component.Context object carrying environment and client metadata.
Optionalapp?: { name: string; version: string }Application-level metadata.
Name of the application.
Version of the application.
Campaign attribution metadata.
Optionalcontent?: stringCampaign content (e.g., utm_content).
Optionalmedium?: stringCampaign medium (e.g., utm_medium).
Optionalname?: stringName of the campaign (e.g., utm_campaign).
Optionalsource?: stringCampaign source (e.g., utm_source).
Optionalterm?: stringCampaign term (e.g., utm_term).
GDPR-related consent information.
Indicates whether the user has given consent.
Analytics library metadata.
Name of the SDK/library (e.g., "@contentful/optimization-web").
Version of the analytics library.
Locale identifier of the event (e.g., "en-US").
Optionallocation?: {Optional geo-location information associated with the event.
Optionalcity?: stringCity name associated with the location.
Optionalcontinent?: stringContinent name associated with the location.
Optionalcoordinates?: { latitude: number; longitude: number }Geographical coordinates for the location.
Latitude component of the coordinates.
Longitude component of the coordinates.
Optionalcountry?: stringCountry name associated with the location.
OptionalcountryCode?: stringCountry code associated with the location.
OptionalpostalCode?: stringPostal or ZIP code associated with the location.
Optionalregion?: stringRegion or state name associated with the location.
OptionalregionCode?: stringRegion or state code associated with the location.
Optionaltimezone?: stringTime zone identifier associated with the location.
Optionalpage?: {Path component of the page URL (e.g., /products/123).
Parsed query parameters for the page.
Referrer URL that led to the current page.
Raw search string including the leading ? (e.g., "?q=test").
Optionaltitle?: stringTitle of the page as seen by the user.
Full URL of the page.
Optionalscreen?: { name: string; [key: string]: JSONType }Name or label for the screen.
OptionaluserAgent?: stringUser agent string of the client, if available.
OptionalexperienceId?: stringIdentifier of the experience that rendered this component.
Unique identifier for this message.
Timestamp when the event originally occurred.
Timestamp when the event payload was sent.
Timestamp when the event was recorded or processed.
Discriminator indicating that this event is a component view.
OptionaluserId?: stringIdentifier of the authenticated user, if known.
Index of the variant associated with this component view.
This is a specialized variant of EventBuilder.buildComponentView
that sets componentType to 'Variable'.
Builds an identify event payload to associate a user ID with traits.
IdentifyBuilderArgs arguments describing the identified user.
An IdentifyEvent payload.
Channel from which the event originated.
Context object carrying environment and client metadata.
Optionalapp?: { name: string; version: string }Application-level metadata.
Name of the application.
Version of the application.
Campaign attribution metadata.
Optionalcontent?: stringCampaign content (e.g., utm_content).
Optionalmedium?: stringCampaign medium (e.g., utm_medium).
Optionalname?: stringName of the campaign (e.g., utm_campaign).
Optionalsource?: stringCampaign source (e.g., utm_source).
Optionalterm?: stringCampaign term (e.g., utm_term).
GDPR-related consent information.
Indicates whether the user has given consent.
Analytics library metadata.
Name of the SDK/library (e.g., "@contentful/optimization-web").
Version of the analytics library.
Locale identifier of the event (e.g., "en-US").
Optionallocation?: {Optional geo-location information associated with the event.
Optionalcity?: stringCity name associated with the location.
Optionalcontinent?: stringContinent name associated with the location.
Optionalcoordinates?: { latitude: number; longitude: number }Geographical coordinates for the location.
Latitude component of the coordinates.
Longitude component of the coordinates.
Optionalcountry?: stringCountry name associated with the location.
OptionalcountryCode?: stringCountry code associated with the location.
OptionalpostalCode?: stringPostal or ZIP code associated with the location.
Optionalregion?: stringRegion or state name associated with the location.
OptionalregionCode?: stringRegion or state code associated with the location.
Optionaltimezone?: stringTime zone identifier associated with the location.
Optionalpage?: {Path component of the page URL (e.g., /products/123).
Parsed query parameters for the page.
Referrer URL that led to the current page.
Raw search string including the leading ? (e.g., "?q=test").
Optionaltitle?: stringTitle of the page as seen by the user.
Full URL of the page.
Optionalscreen?: { name: string; [key: string]: JSONType }Name or label for the screen.
OptionaluserAgent?: stringUser agent string of the client, if available.
Unique identifier for this message.
Timestamp when the event originally occurred.
Timestamp when the event payload was sent.
Timestamp when the event was recorded or processed.
Traits describing the user.
Discriminator indicating that this event is an identify event.
OptionaluserId?: stringIdentifier of the authenticated user, if known.
Builds a page view event payload.
Optional PageViewBuilderArgs overrides for the page view event.
A PageViewEvent payload.
Channel from which the event originated.
Optionalapp?: { name: string; version: string }Application-level metadata.
Name of the application.
Version of the application.
Campaign attribution metadata.
Optionalcontent?: stringCampaign content (e.g., utm_content).
Optionalmedium?: stringCampaign medium (e.g., utm_medium).
Optionalname?: stringName of the campaign (e.g., utm_campaign).
Optionalsource?: stringCampaign source (e.g., utm_source).
Optionalterm?: stringCampaign term (e.g., utm_term).
GDPR-related consent information.
Indicates whether the user has given consent.
Analytics library metadata.
Name of the SDK/library (e.g., "@contentful/optimization-web").
Version of the analytics library.
Locale identifier of the event (e.g., "en-US").
Optionallocation?: {Optional geo-location information associated with the event.
Optionalcity?: stringCity name associated with the location.
Optionalcontinent?: stringContinent name associated with the location.
Optionalcoordinates?: { latitude: number; longitude: number }Geographical coordinates for the location.
Latitude component of the coordinates.
Longitude component of the coordinates.
Optionalcountry?: stringCountry name associated with the location.
OptionalcountryCode?: stringCountry code associated with the location.
OptionalpostalCode?: stringPostal or ZIP code associated with the location.
Optionalregion?: stringRegion or state name associated with the location.
OptionalregionCode?: stringRegion or state code associated with the location.
Optionaltimezone?: stringTime zone identifier associated with the location.
Page context for events that occur within a web page.
Path component of the page URL (e.g., /products/123).
Parsed query parameters for the page.
Referrer URL that led to the current page.
Raw search string including the leading ? (e.g., "?q=test").
Optionaltitle?: stringTitle of the page as seen by the user.
Full URL of the page.
OptionaluserAgent?: stringUser agent string of the client, if available.
Unique identifier for this message.
Optionalname?: stringOptional name for the page.
Timestamp when the event originally occurred.
Page-level properties such as URL, path, and referrer.
Path component of the page URL (e.g., /products/123).
Parsed query parameters for the page.
Referrer URL that led to the current page.
Raw search string including the leading ? (e.g., "?q=test").
Optionaltitle?: stringTitle of the page as seen by the user.
Full URL of the page.
Timestamp when the event payload was sent.
Timestamp when the event was recorded or processed.
Discriminator indicating that this event is a page view.
OptionaluserId?: stringIdentifier of the authenticated user, if known.
Page properties are created by merging:
properties argument passed in.The title always falls back to DEFAULT_PAGE_PROPERTIES.title when undefined.
Builds a screen view event payload.
ScreenViewBuilderArgs arguments for the screen view event.
A ScreenViewEvent payload.
Channel from which the event originated.
Optionalapp?: { name: string; version: string }Application-level metadata.
Name of the application.
Version of the application.
Campaign attribution metadata.
Optionalcontent?: stringCampaign content (e.g., utm_content).
Optionalmedium?: stringCampaign medium (e.g., utm_medium).
Optionalname?: stringName of the campaign (e.g., utm_campaign).
Optionalsource?: stringCampaign source (e.g., utm_source).
Optionalterm?: stringCampaign term (e.g., utm_term).
GDPR-related consent information.
Indicates whether the user has given consent.
Analytics library metadata.
Name of the SDK/library (e.g., "@contentful/optimization-web").
Version of the analytics library.
Locale identifier of the event (e.g., "en-US").
Optionallocation?: {Optional geo-location information associated with the event.
Optionalcity?: stringCity name associated with the location.
Optionalcontinent?: stringContinent name associated with the location.
Optionalcoordinates?: { latitude: number; longitude: number }Geographical coordinates for the location.
Latitude component of the coordinates.
Longitude component of the coordinates.
Optionalcountry?: stringCountry name associated with the location.
OptionalcountryCode?: stringCountry code associated with the location.
OptionalpostalCode?: stringPostal or ZIP code associated with the location.
Optionalregion?: stringRegion or state name associated with the location.
OptionalregionCode?: stringRegion or state code associated with the location.
Optionaltimezone?: stringTime zone identifier associated with the location.
Screen context for events that occur within a web page.
Name or label for the screen.
OptionaluserAgent?: stringUser agent string of the client, if available.
Unique identifier for this message.
Name of the screen being viewed.
Timestamp when the event originally occurred.
Optionalproperties?: Record<string, JSONType>Optional properties describing the screen context.
Timestamp when the event payload was sent.
Timestamp when the event was recorded or processed.
Discriminator indicating that this event is a screen view.
OptionaluserId?: stringIdentifier of the authenticated user, if known.
Builds a track event payload for arbitrary user actions.
TrackBuilderArgs arguments describing the tracked event.
A TrackEvent payload.
Channel from which the event originated.
Context object carrying environment and client metadata.
Optionalapp?: { name: string; version: string }Application-level metadata.
Name of the application.
Version of the application.
Campaign attribution metadata.
Optionalcontent?: stringCampaign content (e.g., utm_content).
Optionalmedium?: stringCampaign medium (e.g., utm_medium).
Optionalname?: stringName of the campaign (e.g., utm_campaign).
Optionalsource?: stringCampaign source (e.g., utm_source).
Optionalterm?: stringCampaign term (e.g., utm_term).
GDPR-related consent information.
Indicates whether the user has given consent.
Analytics library metadata.
Name of the SDK/library (e.g., "@contentful/optimization-web").
Version of the analytics library.
Locale identifier of the event (e.g., "en-US").
Optionallocation?: {Optional geo-location information associated with the event.
Optionalcity?: stringCity name associated with the location.
Optionalcontinent?: stringContinent name associated with the location.
Optionalcoordinates?: { latitude: number; longitude: number }Geographical coordinates for the location.
Latitude component of the coordinates.
Longitude component of the coordinates.
Optionalcountry?: stringCountry name associated with the location.
OptionalcountryCode?: stringCountry code associated with the location.
OptionalpostalCode?: stringPostal or ZIP code associated with the location.
Optionalregion?: stringRegion or state name associated with the location.
OptionalregionCode?: stringRegion or state code associated with the location.
Optionaltimezone?: stringTime zone identifier associated with the location.
Optionalpage?: {Path component of the page URL (e.g., /products/123).
Parsed query parameters for the page.
Referrer URL that led to the current page.
Raw search string including the leading ? (e.g., "?q=test").
Optionaltitle?: stringTitle of the page as seen by the user.
Full URL of the page.
Optionalscreen?: { name: string; [key: string]: JSONType }Name or label for the screen.
OptionaluserAgent?: stringUser agent string of the client, if available.
Name of the event being tracked.
Unique identifier for this message.
Timestamp when the event originally occurred.
Additional properties describing the event.
Timestamp when the event payload was sent.
Timestamp when the event was recorded or processed.
Discriminator indicating that this event is a track event.
OptionaluserId?: stringIdentifier of the authenticated user, if known.
ProtectedbuildProtectedBuilds the universal event properties shared across all event types.
Arguments overriding the default context values.
A fully populated UniversalEventProperties object.
Channel from which the event originated.
Context object carrying environment and client metadata.
Optionalapp?: { name: string; version: string }Application-level metadata.
Name of the application.
Version of the application.
Campaign attribution metadata.
Optionalcontent?: stringCampaign content (e.g., utm_content).
Optionalmedium?: stringCampaign medium (e.g., utm_medium).
Optionalname?: stringName of the campaign (e.g., utm_campaign).
Optionalsource?: stringCampaign source (e.g., utm_source).
Optionalterm?: stringCampaign term (e.g., utm_term).
GDPR-related consent information.
Indicates whether the user has given consent.
Analytics library metadata.
Name of the SDK/library (e.g., "@contentful/optimization-web").
Version of the analytics library.
Locale identifier of the event (e.g., "en-US").
Optionallocation?: {Optional geo-location information associated with the event.
Optionalcity?: stringCity name associated with the location.
Optionalcontinent?: stringContinent name associated with the location.
Optionalcoordinates?: { latitude: number; longitude: number }Geographical coordinates for the location.
Latitude component of the coordinates.
Longitude component of the coordinates.
Optionalcountry?: stringCountry name associated with the location.
OptionalcountryCode?: stringCountry code associated with the location.
OptionalpostalCode?: stringPostal or ZIP code associated with the location.
Optionalregion?: stringRegion or state name associated with the location.
OptionalregionCode?: stringRegion or state code associated with the location.
Optionaltimezone?: stringTime zone identifier associated with the location.
Optionalpage?: {Path component of the page URL (e.g., /products/123).
Parsed query parameters for the page.
Referrer URL that led to the current page.
Raw search string including the leading ? (e.g., "?q=test").
Optionaltitle?: stringTitle of the page as seen by the user.
Full URL of the page.
Optionalscreen?: { name: string; [key: string]: JSONType }Name or label for the screen.
OptionaluserAgent?: stringUser agent string of the client, if available.
Unique identifier for this message.
Timestamp when the event originally occurred.
Timestamp when the event payload was sent.
Timestamp when the event was recorded or processed.
OptionaluserId?: stringIdentifier of the authenticated user, if known.
This method is used internally by the specific event-builder methods (e.g. EventBuilder.buildPageView).
Internal helper class for building analytics and personalization events.
Remarks
This class coordinates configuration and argument validation to produce strongly-typed event payloads compatible with
@contentful/optimization-api-schemas.