Skip to content

Commit c22ada9

Browse files
author
Sachin Maheshwari
committed
adding support for utm_campaign and utm_medium
1 parent b45d1fa commit c22ada9

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

web-assets/js/setupAuth0WithRedirect.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,16 @@ const authSetup = function () {
3737
const shouldLogout = qs['logout'];
3838
const regSource = qs['regSource'];
3939
const utmSource = qs['utm_source'];
40+
const utmMedium = qs['utm_medium'];
41+
const utmCampaign = qs['utm_campaign'];
4042
const appUrl = qs['appUrl'] || false;
4143
const loggerMode = "dev";
4244
const IframeLogoutRequestType = "LOGOUT_REQUEST";
45+
const enterpriseCustomers = ['wipro', 'zurich', 'cs'];
4346

44-
if (utmSource && utmSource != 'undefined') {
47+
if (utmSource &&
48+
(utmSource != 'undefined') &&
49+
(enterpriseCustomers.indexOf(utmSource) > -1)) {
4550
domain = "topcoder-dev.auth0.com";
4651
returnAppUrl += '&utm_source=' + utmSource;
4752
}
@@ -131,7 +136,9 @@ const authSetup = function () {
131136
.loginWithRedirect({
132137
redirect_uri: host + '?appUrl=' + returnAppUrl,
133138
regSource: regSource,
134-
utmSource: utmSource
139+
utmSource: utmSource,
140+
utmCampaign: utmCampaign,
141+
utmMedium: utmMedium
135142
})
136143
.then(function () {
137144
auth0.isAuthenticated().then(function (isAuthenticated) {
@@ -216,7 +223,7 @@ const authSetup = function () {
216223
host = registerSuccessUrl;
217224
logout();
218225
}
219-
}).catch(function(e) {
226+
}).catch(function (e) {
220227
logger("Error in fetching token from auth0: ", e);
221228
});
222229
};
@@ -297,7 +304,7 @@ const authSetup = function () {
297304
const v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
298305
return v ? v[2] : undefined;
299306
}
300-
// end token.js
307+
// end token.js
301308

302309
function getHostDomain() {
303310
let hostDomain = "";

0 commit comments

Comments
 (0)