DavidWells / analytics

Lightweight analytics abstraction layer for tracking page views, custom events, & identifying visitors
https://getanalytics.io
MIT License
2.38k stars 240 forks source link

Angular Failed to Compile #402

Closed theelement115 closed 9 months ago

theelement115 commented 9 months ago

I am integrating google analytics with an angular project but i am unable to import the @analytics/google-analytics package.

But when I run ng serve i get this error.

Error: export 'googleAnalytics' (imported as 'googleAnalytics') was not found in '@analytics/google-analytics' (possible exports: default, init)

✖ Failed to compile.

this is my code:

import {Analytics} from 'analytics'
import {googleAnalytics} from '@analytics/google-analytics'

export class ProductViewComponent {

  ...
  analytics = Analytics({
      app: 'Zaito web',
      plugins: [
        googleAnalytics({
          measurementIds: ['G-*********']
        })
      ]
    })
DavidWells commented 9 months ago

Change import to

import googleAnalytics from '@analytics/google-analytics'