Skip to content

Commit 2440e9a

Browse files
authored
fix: assign domain after cookie storage options are given (#528)
* fix: Assign domain after cookie storage options are added * fix: address comment
1 parent 03fe181 commit 2440e9a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/amplitude-client.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,14 @@ AmplitudeClient.prototype.init = function init(apiKey, opt_userId, opt_config, o
141141
const hasNewCookie = !!this._metadataStorage.load();
142142
this._useOldCookie = !hasNewCookie && hasOldCookie && !this.options.cookieForceUpgrade;
143143
const hasCookie = hasNewCookie || hasOldCookie;
144-
this.options.domain = this.cookieStorage.options().domain;
145144

146145
if (this.options.deferInitialization && !hasCookie) {
147146
this._deferInitialization(apiKey, opt_userId, opt_config, opt_callback);
148147
return;
149148
}
150149

150+
this.options.domain = this.cookieStorage.options().domain;
151+
151152
if (type(this.options.logLevel) === 'string') {
152153
utils.setLogLevel(this.options.logLevel);
153154
}

0 commit comments

Comments
 (0)