3

I would like to track app usage using Google Analytics in a PhoneGap 3.0 Build app.

Unfortunately, the GAnalytics Plugin (https://build.phonegap.com/plugins/156) does not support PhoneGap Build 3.0.

Currently, my options are:

  1. PhoneGap Build 3.0 without Google Analytics
  2. Phonegap Build 2.9.0 with Google Analytics using GAnalytics plugins.

There must be a way to track using Google Analytics in PhoneGap BUILD 3.0 -- I can't imagine the community could live without it.

Any pointers?

I just want to emphasize that I'm using PhoneGap BUILD and jQuery Mobile.

Cheers

omidkia
  • 95
  • 1
  • 5

5 Answers5

5

As of October 25th, 2013 it is now supported with PhoneGap Build 3.0. Looks like you just missed this by a few days!

See here: https://build.phonegap.com/plugins/297

dotNetkow
  • 5,053
  • 4
  • 35
  • 50
  • The page gives you "_Plugin not found_". Just search for the string "_GAPlugin_" in the page. – ricricucit Feb 21 '14 at 11:19
  • Any idea on how to use this plugin without Phonegap Build? I create my apps with Eclipse... – Albert Feb 25 '14 at 17:37
  • Hi Albert - good news, most plugins have their full source code available on GitHub. Simply look up the plugin on http://build.phonegap.com/plugins and click the repository link towards the bottom of each page. – dotNetkow Feb 26 '14 at 02:18
0

Two more options for you though neither of them are quick.

Option 3: Email the author of the GAPlugin, ask them to update it, and hope that they do.

Option 4: Fork the code for the GAPlugin on github, modify it to support PGB3.0 and resubmit it to Phonegap.

If you really need the GAPlugin right now, then you are best to use PGB2.9.

Dom
  • 2,569
  • 1
  • 18
  • 28
0

I use Phonegap build and GA plug in also, check this out:

https://build.phonegap.com/plugins/262

and this links comes very handy to check all the core and 3d party plug ins:

https://build.phonegap.com/plugins/core

Hope this helps!

Arcayne
  • 1,186
  • 1
  • 15
  • 35
0

I have used Phonegap Build and GA plugin recently and I did not face any problem of using it, here is step by step explanation on using GA plugin.

  1. first create a google analytics account.
  2. There Admin -> (Create Account) select “Create new account” from drop down
  3. select “App” from “What would you like to track?”
  4. fill the rest of the filed by giving the relevant details
  5. Hit “Get Tracking ID” and copy paste it to a note pad file

Next, GA is a plugin in phonegap so we need to add it in the config.xml

<gap:plugin name="com.adobe.plugins.gaplugin" />

Here is a complete code for your review

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

        document.addEventListener("deviceready", init, false);
        var AnalyticsAccount = "UA-12341712-1";

        var testDiv;

        function errorHandler(e) {
            //error handler 
        }

        function successhandler() {
            //successhanlder
        }

        function init() {
            gaPlugin = window.plugins.gaPlugin;
            gaPlugin.init(successhandler, errorHandler, AnalyticsAccount, 10);    

            //Records event
            document.querySelector("#analyticsbutton").addEventListener("click", function(e) { 
                e.preventDefault();
                gaPlugin.trackEvent(function() {
                    alert("Button event was recorded");

                }, errorHandler, "Button", "Click", "Test button was clicked", 11);    

            });
        }

    </script>

</head>

<body>
    <h1>Analytics Test!!!!!!!!</h1>
     <br/>
    <button id="analyticsbutton">Test</button><br/>        
     <br/>
</body>

ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
Imal Hasaranga Perera
  • 9,683
  • 3
  • 51
  • 41
  • You need to stop spamvertising your blog **right now**. – ThiefMaster Mar 04 '14 at 21:55
  • I'm sorry i'm new to stackoverflow i don't know the rules my blog post explain this clearly that is the reason why i link it to this post! is it illegal in stackoverflow ? – Imal Hasaranga Perera Mar 05 '14 at 08:04
  • Pointing users at an external resource which answers their specific question is welcomed. Pointing them at a post you wrote which answers the question is also fine (although it's advisable to make it obvious you wrote it). Trying to drive traffic to your blog which covers roughly the same topic is not acceptable. Hope that clarifies things slightly – Basic May 17 '14 at 15:03
  • Thanks, I'll be more careful from now – Imal Hasaranga Perera May 17 '14 at 16:54
  • @l2aelba, I'm really confused, all the two posts were asking about a way that they can use to record video and audio using webrtc so i gave them a clear resource and it clearly explain how to do that so how does my answers can be spam ? also you have -1 to them as well – Imal Hasaranga Perera May 29 '14 at 06:46
0

NOTE: FOR ALL PLATFORMS WITHOUT PLUGIN USED Google Analytics Client Traking ID generated for mobile platform only supports for IOS and Android.So if you want to Track your google analytics,Be Sure you have Created it for website. Only Tracking ID for website work with phone gap all platform apps. You can then Simply download GALocalStorage from below link and then place it in you js folder under www folder

www
 |__
    js
      |__
          GALocalStorage.js

Then write the below code under your < head> tag,and its start showing Realtime active Users in your dashboards.

https://github.com/ggendre/GALocalStorage

       <script>
        ga_storage._setAccount('UA-XXXXXXXX-X'); //Replace with your own
        ga_storage._trackPageview('Home Screen');
        </script>
9to5ios
  • 5,319
  • 2
  • 37
  • 65