-
-
Save morariu/4f9cf55086085b9ebc775faac30c5add to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ionic Native plugin: http://ionicframework.com/docs/native/firebase/ | |
base-page.ts | |
------------- | |
import { Firebase } from "@ionic-native/firebase"; | |
export abstract class BasePage { | |
constructor(public firebase: Firebase) { } | |
//collect Analytics | |
protected collectAnalytics(contentType: string, itemId: string): void { | |
this.firebase.logEvent("select_content", { content_type: contentType, item_id: itemId }) | |
.then((success) => console.log(`success`)) | |
.catch(error => console.error('Error', error)); | |
} | |
} | |
my-page.ts | |
---------- | |
export class MyPage extends BasePage { | |
constructor(private platform: Platform, public firebase: Firebase) { | |
super(firebase); | |
} | |
ionViewDidLoad() { | |
this.platform.ready().then(() => { | |
super.collectAnalytics('add page view', 'survey');//collect Analytics | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment