angular-gtag
angular-gtag copied to clipboard
trackingId removed when run production mode.
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
Same here, though it doesn't seem to matter if it's in the environment files or not in NG7
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