-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure whether mixpanel is enabled with env variable
- Loading branch information
Chris Collins
authored and
Chris Collins
committed
Apr 27, 2022
1 parent
b811254
commit 19b0bb8
Showing
11 changed files
with
132 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
datahub-web-react/src/app/analytics/__tests__/analytics.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { getMergedTrackingOptions, THIRD_PARTY_LOGGING_KEY } from '../analytics'; | ||
|
||
describe('getMergedTrackingOptions', () => { | ||
it('should update or create an options object with mixpanel set to the value of what is in localStorage', () => { | ||
// before anything is set in localStorage | ||
let trackingOptions = getMergedTrackingOptions(); | ||
expect(trackingOptions).toMatchObject({ | ||
plugins: { | ||
mixpanel: false, | ||
}, | ||
}); | ||
|
||
localStorage.setItem(THIRD_PARTY_LOGGING_KEY, 'false'); | ||
trackingOptions = getMergedTrackingOptions(); | ||
expect(trackingOptions).toMatchObject({ | ||
plugins: { | ||
mixpanel: false, | ||
}, | ||
}); | ||
|
||
localStorage.setItem(THIRD_PARTY_LOGGING_KEY, 'true'); | ||
trackingOptions = getMergedTrackingOptions(); | ||
expect(trackingOptions).toMatchObject({ | ||
plugins: { | ||
mixpanel: true, | ||
}, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,9 @@ query appConfig { | |
visualConfig { | ||
logoUrl | ||
} | ||
trackingConfig { | ||
isThirdPartyLoggingEnabled | ||
} | ||
} | ||
} | ||
|
||
|
24 changes: 24 additions & 0 deletions
24
...ervice/factories/src/main/java/com/linkedin/gms/factory/common/TrackingConfigFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.linkedin.gms.factory.common; | ||
|
||
import com.linkedin.datahub.graphql.generated.TrackingConfiguration; | ||
import javax.annotation.Nonnull; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
|
||
@Configuration | ||
public class TrackingConfigFactory { | ||
@Value("${trackingConfig.isThirdPartyLoggingEnabled}") | ||
private Boolean isThirdPartyLoggingEnabled; | ||
|
||
@Nonnull | ||
@Bean(name = "trackingConfig") | ||
protected TrackingConfiguration getInstance() { | ||
TrackingConfiguration config = new TrackingConfiguration(); | ||
config.setIsThirdPartyLoggingEnabled(isThirdPartyLoggingEnabled); | ||
|
||
return config; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters