Skip to content

trackkit / providers/ga4/types / GA4Options

Type Alias: GA4Options

GA4Options = BaseProviderOptions & object

Defined in: providers/ga4/types.ts:10

Configuration options for the GA4 provider.

Extends BaseProviderOptions with GA4-specific fields such as measurementId and optional apiSecret.

Type Declaration

name

name: "ga4"

Provider name discriminator.

measurementId?

optional measurementId: string

Google Analytics 4 measurement ID (alternative to site alias).

Example

ts
'G-XXXXXXXXXX'

apiSecret?

optional apiSecret: string

Custom API secret for server-side tracking using the GA4 Measurement Protocol.

Required in many GA4 setups when sending events directly to the MP endpoint.

customDimensions?

optional customDimensions: Record<string, string | undefined>

Custom dimensions mapping.

Maps friendly names to GA4 dimension keys.

Example

ts
{ plan_type: 'custom_dimension_1' }

customMetrics?

optional customMetrics: Record<string, string | undefined>

Custom metrics mapping.

Maps friendly names to GA4 metric keys.

Example

ts
{ engagement_score: 'custom_metric_1' }

debugEndpoint?

optional debugEndpoint: boolean

When true, send events to the GA4 validation endpoint (/debug/mp/collect) instead of the production endpoint.

Useful for validating payloads without polluting real data.

debugMode?

optional debugMode: boolean

When true, add GA4 debug_mode=1 event param so events show in GA4 DebugView.

Released under the MIT License.