Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(amplitude) add amplitude UTM tracking option

Andrei Gavrilescu5a3947bb238d
diff --git a/config.js b/config.js
index c33e7ce2b9..10287e6098 100644
--- a/config.js
+++ b/config.js
@@ -1015,6 +1015,10 @@ var config = {
// The Amplitude APP Key:
// amplitudeAPPKey: '<APP_KEY>',
+ // Enables Amplitude UTM tracking:
+ // Default value is false.
+ // amplitudeIncludeUTM: false,
+
// Obfuscates room name sent to analytics (amplitude, rtcstats)
// Default value is false.
// obfuscateRoomName: false,
diff --git a/react/features/analytics/functions.ts b/react/features/analytics/functions.ts
index 935565f057..51c0da9727 100644
--- a/react/features/analytics/functions.ts
+++ b/react/features/analytics/functions.ts
@@ -82,6 +82,7 @@ export async function createHandlers({ getState }: IStore) {
} = config;
const {
amplitudeAPPKey,
+ amplitudeIncludeUTM,
blackListedEvents,
scriptURLs,
googleAnalyticsTrackingId,
@@ -92,6 +93,7 @@ export async function createHandlers({ getState }: IStore) {
const { group, user } = state['features/base/jwt'];
const handlerConstructorOptions = {
amplitudeAPPKey,
+ amplitudeIncludeUTM,
blackListedEvents,
envType: deploymentInfo?.envType || 'dev',
googleAnalyticsTrackingId,
diff --git a/react/features/analytics/handlers/AbstractHandler.ts b/react/features/analytics/handlers/AbstractHandler.ts
index b478b179e8..1b884b05be 100644
--- a/react/features/analytics/handlers/AbstractHandler.ts
+++ b/react/features/analytics/handlers/AbstractHandler.ts
@@ -11,6 +11,7 @@ export interface IEvent {
interface IOptions {
amplitudeAPPKey?: string;
+ amplitudeIncludeUTM?: boolean;
blackListedEvents?: string[];
envType?: string;
googleAnalyticsTrackingId?: string;
diff --git a/react/features/analytics/handlers/AmplitudeHandler.ts b/react/features/analytics/handlers/AmplitudeHandler.ts
index 4268e297c7..45bf677b82 100644
--- a/react/features/analytics/handlers/AmplitudeHandler.ts
+++ b/react/features/analytics/handlers/AmplitudeHandler.ts
@@ -15,13 +15,18 @@ export default class AmplitudeHandler extends AbstractHandler {
* Creates new instance of the Amplitude analytics handler.
*
* @param {Object} options -
- * @param {string} options.amplitudeAPPKey - The Amplitude app key required
- * by the Amplitude API.
+ * @param {string} options.amplitudeAPPKey - The Amplitude app key required by the Amplitude API.
+ * @param {boolean} options.amplitudeIncludeUTM - Whether to include UTM parameters
+ * in the Amplitude events.
*/
constructor(options: any) {
super(options);
- const { amplitudeAPPKey, user } = options;
+ const {
+ amplitudeAPPKey,
+ amplitudeIncludeUTM: includeUtm = true,
+ user
+ } = options;
this._enabled = true;
@@ -43,6 +48,8 @@ export default class AmplitudeHandler extends AbstractHandler {
} else {
const amplitudeOptions: any = {
includeReferrer: true,
+ includeUtm,
+ saveParamsReferrerOncePerSession: false,
onError
};
diff --git a/react/features/base/config/configType.ts b/react/features/base/config/configType.ts
index d72b123f89..5f2da0342d 100644
--- a/react/features/base/config/configType.ts
+++ b/react/features/base/config/configType.ts
@@ -182,6 +182,7 @@ export interface IConfig {
_screenshotHistoryRegionUrl?: number;
analytics?: {
amplitudeAPPKey?: string;
+ amplitudeIncludeUTM?: boolean;
blackListedEvents?: string[];
disabled?: boolean;
googleAnalyticsTrackingId?: string;