Skip to content

Instantly share code, notes, and snippets.

Last active September 4, 2018 18:04
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Sampath-Lokuge/c532167c544dd15b2d0d390bbdff4b27 to your computer and use it in GitHub Desktop.
Ionic Native plugin:
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));
export class MyPage extends BasePage {
constructor(private platform: Platform, public firebase: 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