Skip to content
This repository was archived by the owner on Nov 23, 2019. It is now read-only.

Commit 0fc1b58

Browse files
author
Brandon Sneed
committed
Fixes an error when local storage is disabled.
1 parent dcfb8f0 commit 0fc1b58

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,14 @@ Segment.prototype.normalize = function(msg) {
275275
msg.writeKey = this.options.apiKey;
276276
ctx.userAgent = navigator.userAgent;
277277
if (!ctx.library) ctx.library = { name: 'analytics.js', version: this.analytics.VERSION };
278-
var crossDomainId = this.getCachedCrossDomainId();
279-
if (crossDomainId && this.isCrossDomainAnalyticsEnabled()) {
280-
if (!ctx.traits) {
281-
ctx.traits = { crossDomainId: crossDomainId };
282-
} else if (!ctx.traits.crossDomainId) {
283-
ctx.traits.crossDomainId = crossDomainId;
278+
if (this.isCrossDomainAnalyticsEnabled()) {
279+
var crossDomainId = this.getCachedCrossDomainId();
280+
if (crossDomainId) {
281+
if (!ctx.traits) {
282+
ctx.traits = { crossDomainId: crossDomainId };
283+
} else if (!ctx.traits.crossDomainId) {
284+
ctx.traits.crossDomainId = crossDomainId;
285+
}
284286
}
285287
}
286288
// if user provides campaign via context, do not overwrite with UTM qs param

0 commit comments

Comments
 (0)