import googleAnalytics from '@analytics/google-analytics' ; import Analytics , { AnalyticsPlugin } from 'analytics' ; import { isNull } from 'lodash' ; import getMetaTag from '../utils/getMetaTag' ; const getPlugins = ( ) : AnalyticsPlugin [ ] => { let plugins = [ ] ; const analyticsConfig = getMetaTag ( 'gaTrackingID' ) ; if ( ! isNull ( analyticsConfig ) && analyticsConfig !== '' && analyticsConfig !== '{{ .gaTrackingID }}' ) { plugins . push ( googleAnalytics ( { trackingId : analyticsConfig , } ) ) ; } return plugins ; } ; const analytics = Analytics ( { app : 'ArtifactHub' , plugins : getPlugins ( ) , } ) ; export default analytics ;