use mattermost siteURL to determine rudder cookie domain (#2294)

This commit is contained in:
Julien Tant 2022-02-09 15:53:47 -07:00 committed by GitHub
parent b92a3a9786
commit dfa5d54b16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -172,7 +172,14 @@ export default class Plugin {
}
if (rudderKey !== '') {
rudderAnalytics.load(rudderKey, rudderUrl)
const rudderCfg = {} as {setCookieDomain: string}
if (siteURL && siteURL !== '') {
try {
rudderCfg.setCookieDomain = new URL(siteURL).hostname
// eslint-disable-next-line no-empty
} catch (_) {}
}
rudderAnalytics.load(rudderKey, rudderUrl, rudderCfg)
rudderAnalytics.identify(config?.telemetryid, {}, TELEMETRY_OPTIONS)