Skip to content

Instantly share code, notes, and snippets.

@molcik
Created November 18, 2017 11:48
Show Gist options
  • Save molcik/c28ca9dc62217a0a40b797fb5f545883 to your computer and use it in GitHub Desktop.
Save molcik/c28ca9dc62217a0a40b797fb5f545883 to your computer and use it in GitHub Desktop.
Angular Google Analytics App Module Setup
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { environment } from '../environments/environment';
import { AppComponent } from './app.component';
import {GoogleAnalyticsService} from "./services/google-analytics.service";
@NgModule({
declarations: [
AppComponent
]
providers: [
GoogleAnalyticsService
],
bootstrap: [AppComponent]
})
export class AppModule {
constructor(protected _googleAnalyticsService: GoogleAnalyticsService) { } <-- We inject the service here to keep it alive whole time
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment