0
votes

I'm using this Google Analytics plugin for my Phonegap project https://github.com/phonegap-build/GAPlugin.

Everything works fine when I run it in the Android emulator. But when I use Phonegap remote build the plugin does not work. The plugin is listed along with other working plugins in the Phonegap app page.

Here's my code:

In config.xml

<gap:plugin name="com.adobe.plugins.gaplugin" version="2.3.1" source="pgb" />

In index.html

<script type="text/javascript" src="cordova.js"></
<script type="text/javascript" src="GAPlugin.js"></script>
<script type="text/javascript" src="js/index.js"></script>

In www/index.js after the device is ready (I censored the GA ID)

var gaPlugin = window.plugins.gaPlugin;
gaPlugin.init(function () {
    log.innerHTML += 'ga ok.';
}, function (e) {
    log.innerHTML += 'ga failed.' + e;
}, "UA-XXX-Y", 10);
gaPlugin.trackPage(function () {
    log.innerHTML += 'tracked';
}, function () {
    log.innerHTML += 'nope';
}, "test.com");

When I look into the build log I can't find any text "gaplugin". I don't know if it is even building the plugin or if I'm getting an error. I can't even use the debugger because the target is never listed.

Thanks for any help.

1
check the README on this here: github.com/phonegap-build/GAPlugin/tree/… You do not add the JS in your index file anymore for this. Also see their updated usages. - Dawson Loudon
I tried with and without the script tag. Both doesn't work. - Dalton Tan

1 Answers

1
votes

It turns out that if you're using hydrate, you have to re-install the APK instead of just reloading when you add a new plugin.