philmerrell / capacitor-firebase-analytics

Capacitor plugin that integrates Firebase Analytics for Android and iOS
17 stars 22 forks source link

Importing Plugin - Ionic Vue #10

Open frontendjordan opened 5 years ago

frontendjordan commented 5 years ago

Hello,

I am trying to log events with the plugin but having no luck. I've built the app with @ionic/vue.

In a Home.vue single file component, I have:

import { Plugins, DeviceInfo } from '@capacitor/core'; import { CapacitorFirebaseAnalytics } from 'capacitor-firebase-analytics';

and down in a method, I want to:

Plugins.CapacitorFirebaseAnalytics.logEvent({ name: 'school_select', parameters: { school: this.school }});

I build and copy to Xcode and try and run the app and it crashes. Any help for a total beginner to mobile development?

nikmartin commented 5 years ago

is this.school a string?

frontendjordan commented 5 years ago

Good call....this.school is the whole object. I'm guessing that I need to send a string.

nikmartin commented 5 years ago

yes or at least simple types like string, bool, number

jordanmarshall12 commented 5 years ago

Still not having any luck getting this to work...

Do my imports look right to you? Instead of Plugins.CapacitorFirebaseAnalytics.logEvent I should just be doing CapacitorFirebaseAnalytics.logEvent?

MikeCraig418 commented 4 years ago

I had a similar issue and was able to resolve it by running npx cap update after I installed the plugin and prior to building on my device.

I'm not using Ionic, but I am using VueJS + Capacitor.