Skip to content

Commit 69619fc

Browse files
authored
Merge pull request #30 from Mermaid-Chart/MC-2978-add-utm-source-and-utm-medium-for-vs-code-mermaid-chart-sign-up-flow
MC:2978 Added utm source, utm medium and utm campaign at login flow
2 parents 809cff2 + 2ede4e8 commit 69619fc

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

packages/sdk/src/index.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,15 @@ export class MermaidChart {
7575
public async getAuthorizationData({
7676
state,
7777
scope = ['email'],
78+
trackingParams,
7879
}: {
7980
state?: string;
8081
scope?: string[];
82+
trackingParams?: {
83+
utm_source: string;
84+
utm_medium: string;
85+
utm_campaign: string;
86+
}
8187
} = {}): Promise<AuthorizationData> {
8288
if (!this.redirectURI) {
8389
throw new Error('redirectURI is not set');
@@ -96,6 +102,13 @@ export class MermaidChart {
96102
state: stateID,
97103
codeVerifier,
98104
scope,
105+
...(trackingParams && {
106+
extraParams: {
107+
utm_source: trackingParams.utm_source,
108+
utm_medium: trackingParams.utm_medium,
109+
utm_campaign: trackingParams.utm_campaign,
110+
}
111+
}),
99112
});
100113

101114
// Deletes the state after 60 seconds
@@ -253,4 +266,4 @@ export class MermaidChart {
253266
const raw = await this.axios.get<string>(URLS.raw(document, theme).svg);
254267
return raw.data;
255268
}
256-
}
269+
}

0 commit comments

Comments
 (0)