chore: Refactor UTM params to stay compliant with standards (#12312)

We were using UTM params on various branding urls which weren't
compliant to standard utm params and hence were ignored by analytics
tooling. this PR ensures that the params stays compliant with defined
standard

ref: https://en.wikipedia.org/wiki/UTM_parameters

## Changes 

- updated utm tags on widget and survey urls
- added utm on helpcenter branding

---------

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
This commit is contained in:
Sojan Jose
2025-08-29 20:46:52 +02:00
committed by GitHub
parent 99997a701a
commit 9145658597
4 changed files with 60 additions and 11 deletions

View File

@@ -33,13 +33,15 @@ export default {
brandRedirectURL() {
try {
const referrerHost = this.$store.getters['appConfig/getReferrerHost'];
const baseURL = `${this.globalConfig.widgetBrandURL}?utm_source=${
referrerHost ? 'widget_branding' : 'survey_branding'
}`;
const url = new URL(this.globalConfig.widgetBrandURL);
if (referrerHost) {
return `${baseURL}&utm_referrer=${referrerHost}`;
url.searchParams.set('utm_source', referrerHost);
url.searchParams.set('utm_medium', 'widget');
} else {
url.searchParams.set('utm_medium', 'survey');
}
return baseURL;
url.searchParams.set('utm_campaign', 'branding');
return url.toString();
} catch (e) {
// Suppressing the error as getter is not defined in some cases
}