File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,12 @@ export interface LibOptions {
3232
3333 /** Set a custom URL of the API server (for selfhosted variants of Swetrix). */
3434 apiURL ?: string
35+
36+ /**
37+ * Optional profile ID for long-term user tracking.
38+ * If set, it will be used for all pageviews and events unless overridden per-call.
39+ */
40+ profileId ?: string
3541}
3642
3743export interface TrackEventOptions {
@@ -45,6 +51,9 @@ export interface TrackEventOptions {
4551 meta ?: {
4652 [ key : string ] : string | number | boolean | null | undefined
4753 }
54+
55+ /** Optional profile ID for long-term user tracking. Overrides the global profileId if set. */
56+ profileId ?: string
4857}
4958
5059// Partial user-editable pageview payload
@@ -63,6 +72,9 @@ export interface IPageViewPayload {
6372 meta ?: {
6473 [ key : string ] : string | number | boolean | null | undefined
6574 }
75+
76+ /** Optional profile ID for long-term user tracking. Overrides the global profileId if set. */
77+ profileId ?: string
6678}
6779
6880// Partial user-editable error payload
@@ -294,6 +306,7 @@ export class Lib {
294306 ca : getUTMCampaign ( ) ,
295307 te : getUTMTerm ( ) ,
296308 co : getUTMContent ( ) ,
309+ profileId : event . profileId ?? this . options ?. profileId ,
297310 }
298311 await this . sendRequest ( 'custom' , data )
299312 }
@@ -425,6 +438,7 @@ export class Lib {
425438 ca : getUTMCampaign ( ) ,
426439 te : getUTMTerm ( ) ,
427440 co : getUTMContent ( ) ,
441+ profileId : this . options ?. profileId ,
428442 ...payload ,
429443 }
430444
You can’t perform that action at this time.
0 commit comments