@ecomplus/widget-analytics
Version:
Storefront plugin to handle GA Universal Analytics
13 lines (10 loc) • 357 B
JavaScript
import watchAppRoutes from './lib/watch-app-routes'
import watchShoppingCart from './lib/watch-shopping-cart'
export default (options = {}) => {
const { gaTrackingId, googleAdsId } = options
const { gtag } = window
if (typeof gtag === 'function') {
watchAppRoutes(gtag, gaTrackingId, googleAdsId)
watchShoppingCart(gtag, gaTrackingId)
}
}