Skip to content

Commit

Permalink
Merge pull request #33 from dicdiksha/firebase-alalytics-prod
Browse files Browse the repository at this point in the history
firebase analytics
  • Loading branch information
israr-trigyn authored Oct 11, 2023
2 parents 7573c38 + 2f4863b commit 539417d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@angular/compiler": "^11.2.14",
"@angular/compiler-cli": "^11.2.14",
"@angular/core": "^11.2.14",
"@angular/fire": "^6.1.5",
"@angular/forms": "^11.2.14",
"@angular/http": "^7.2.10",
"@angular/localize": "11.2.14",
Expand Down Expand Up @@ -95,6 +96,7 @@
"epubjs": "0.3.88",
"export-to-csv": "0.2.1",
"fine-uploader": "^5.16.2",
"firebase": "^8.2.2",
"font-awesome": "4.7.0",
"gulp": "4.0.2",
"gulp-brotli": "1.2.1",
Expand Down
7 changes: 6 additions & 1 deletion src/app/client/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { CacheService } from 'ng2-cache-service';
import { DOCUMENT } from '@angular/common';
import { image } from '../assets/images/tara-bot-icon';
import { SBTagModule } from 'sb-tag-manager';
import { AngularFireAnalytics } from '@angular/fire/analytics';

/**
* main app component
*/
Expand Down Expand Up @@ -123,7 +125,7 @@ export class AppComponent implements OnInit, OnDestroy {
@ViewChild('resetFontSize') resetFontSize: ElementRef;
@ViewChild('darkModeToggle') darkModeToggle: ElementRef;

constructor(private cacheService: CacheService, private browserCacheTtlService: BrowserCacheTtlService,
constructor(private analytics: AngularFireAnalytics, private cacheService: CacheService, private browserCacheTtlService: BrowserCacheTtlService,
public userService: UserService, private navigationHelperService: NavigationHelperService,
private permissionService: PermissionService, public resourceService: ResourceService,
private deviceRegisterService: DeviceRegisterService, private courseService: CoursesService, private tenantService: TenantService,
Expand All @@ -143,6 +145,9 @@ export class AppComponent implements OnInit, OnDestroy {
} else {
document.documentElement.setAttribute('layout', 'base');
}

this.analytics.logEvent('custom_diksha_web_event', {USER_ID: `DIKSHA${Math.random()*1000}`});

}
/**
* dispatch telemetry window unload event before browser closes
Expand Down
22 changes: 20 additions & 2 deletions src/app/client/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { TranslateStore } from '@ngx-translate/core';
import { SbSearchFilterModule } from '@project-sunbird/common-form-elements';

import { AngularFireAnalyticsModule, ScreenTrackingService } from '@angular/fire/analytics';
import { AngularFireModule } from '@angular/fire';

const firebaseConfig = {
apiKey: "AIzaSyA1rRdz7oyOB7Pf7uKhgfvBacgf8o4inno",
authDomain: "diksha-4446b.firebaseapp.com",
databaseURL: "https://diksha-4446b.firebaseio.com",
projectId: "diksha-4446b",
storageBucket: "diksha-4446b.appspot.com",
messagingSenderId: "280944945973",
appId: "1:280944945973:web:86ba50ffc9e1ec8ab5fa7c",
measurementId: "G-9Z3LDJ42BE"
};

@NgModule({
declarations: [
AppComponent
Expand Down Expand Up @@ -51,7 +65,9 @@ import { SbSearchFilterModule } from '@project-sunbird/common-form-elements';
...PluginModules,
// ngx-translate and the loader module
HttpClientModule,
AppRoutingModule // don't add any module below this because it contains wildcard route
AppRoutingModule, // don't add any module below this because it contains wildcard route
AngularFireModule.initializeApp(firebaseConfig),
AngularFireAnalyticsModule,
],
entryComponents: [AppComponent],
bootstrap: [AppComponent],
Expand All @@ -61,7 +77,9 @@ import { SbSearchFilterModule } from '@project-sunbird/common-form-elements';
TranslateStore,
{ provide: CacheStorageAbstract, useClass: CacheSessionStorage },
{ provide: HTTP_INTERCEPTORS, useClass: SessionExpiryInterceptor, multi: true },
{ provide: RouteReuseStrategy, useClass: CustomRouteReuseStrategy }
{ provide: RouteReuseStrategy, useClass: CustomRouteReuseStrategy },
ScreenTrackingService,
// UserTrackingService
]
})
export class AppModule {
Expand Down

0 comments on commit 539417d

Please sign in to comment.