To add a Cordova plugin to your app, add the plugin in the PhoneGap > Plugins box. For example:

<plugin name="cordova-plugin-google-analytics" spec="1.8.3" source="npm"/>
<plugin name="cordova-build-architecture" spec="https://github.com/MBuchalik/cordova-build-architecture.git#v1.0.1" source="git"/>

Add Cordova plugin

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 :

//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.

Published by Mathieu on January 15, 2019

Freelance Senior Web Developer, WordPress since 2009, JS/Backbone since 2012, Custom Back-End devs, WebApps and Plugins for clients and the community.

Leave a Reply

Your email address will not be published. Required fields are marked *

Having questions?

FAQ | Tutorials | Documentation

Or

Contact Us