Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save morariu/4f9cf55086085b9ebc775faac30c5add to your computer and use it in GitHub Desktop.
Save morariu/4f9cf55086085b9ebc775faac30c5add to your computer and use it in GitHub Desktop.
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