angular-gtag icon indicating copy to clipboard operation
angular-gtag copied to clipboard

trackingId removed when run production mode.

Open insanehong opened this issue 6 years ago • 2 comments

Hi,

I have problem that trackingId removed when run production mode.

application info

  • angular v6.0.6
  • angular-gtag v1.0.3

set Import

# environment.prod.ts

{
  .
  .
   GA_ID : process.env.GA_ID,
  .
  .
}


# app.module.ts
GtagModule.forRoot({ trackingId: environment.GA_ID, trackPageviews: true})

development mode

// in app.comonent.ts
console.log(Gtag) 
> Gtag {router: Router, mergedConfig: {…}}
mergedConfig: {
 trackPageview: true, trackingId: "UA-122xxx040-2"

production mode

// in app.comonent.ts
console.log(Gtag) 
> Gtag {router: Router, mergedConfig: {…}}
mergedConfig: {
 trackPageview: true, trackingId: null

insanehong avatar Aug 09 '18 01:08 insanehong

Same here, though it doesn't seem to matter if it's in the environment files or not in NG7

jonjaques avatar Jun 07 '19 19:06 jonjaques

We have a project which uses webpack and have the same problem: mergedConfig shows null for the trackingId in production. we use angular 8.2.x and gtag 1.0.4

handylearn avatar Jul 30 '20 15:07 handylearn