Skip to content

Commit

Permalink
Update configuration for GA4
Browse files Browse the repository at this point in the history
This is documented in this readme update
DavidWells/analytics#400
  • Loading branch information
MatMoore committed Jun 17, 2024
1 parent 9efd69f commit 4bbbe62
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions datahub-web-react/src/app/analytics/plugin/googleAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import analyticsConfig from '../../../conf/analytics';

const gaConfigs = analyticsConfig.googleAnalytics;
const isEnabled: boolean = gaConfigs || false;
const trackingId = isEnabled ? gaConfigs.trackingId : undefined;
const measurementIds = isEnabled ? gaConfigs.measurementIds : undefined;

const getLabelFromEvent = (event: Event) => {
switch (event.type) {
Expand All @@ -24,7 +24,9 @@ if (isEnabled) {
/**
* Init default GA plugin
*/
const googleAnalyticsPlugin = googleAnalytics({ trackingId });
const googleAnalyticsPlugin = googleAnalytics({
measurementIds,
});

/**
* Lightweight wrapper on top of the default google analytics plugin
Expand Down
2 changes: 1 addition & 1 deletion datahub-web-react/src/conf/analytics.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const config: any = {
// Uncomment below to configure analytics.
// googleAnalytics: {
// trackingId: 'UA-24123123-01',
// measurementIds: ['G-XXXXXXXXX'],
// },
// mixpanel: {
// token: 'fad1285da4e618b618973cacf6565e61',
Expand Down

0 comments on commit 4bbbe62

Please sign in to comment.