To add a Cordova plugin to your app, add the plugin in the PhoneGap > Plugins box. For example:
1 |
<plugin name="cordova-plugin-google-analytics" spec="1.8.3" source="npm"/> |
1 |
<plugin name="cordova-build-architecture" spec="https://github.com/MBuchalik/cordova-build-architecture.git#v1.0.1" source="git"/> |
Then you can use the plugin’s functions (in this example the cordova-plugin-google-analytics plugin’s object is available as window.ga) in your theme’s functions.js file :
1 2 |
//In functions.js or in a JS module included in functions.js: window.ga.trackEvent( category, action, label, value ); |
Then save, export and build the app.