capacitor-firebase-analytics icon indicating copy to clipboard operation
capacitor-firebase-analytics copied to clipboard

Importing Plugin - Ionic Vue

Open frontendjordan opened this issue 6 years ago • 5 comments
trafficstars

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?

frontendjordan avatar Jun 27 '19 23:06 frontendjordan

is this.school a string?

nikmartin avatar Jul 08 '19 15:07 nikmartin

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

frontendjordan avatar Jul 08 '19 19:07 frontendjordan

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

nikmartin avatar Jul 08 '19 19:07 nikmartin

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?

jordanmarshall12 avatar Jul 19 '19 00:07 jordanmarshall12

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.

MikeCraig418 avatar Apr 20 '20 04:04 MikeCraig418