Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The three main components required and the different parts for Android and iOS.</p> <ol> <li><p><strong>GAP-alytics</strong> from <a href="https://github.com/phonegap/phonegap-plugins]" rel="noreferrer">phonegap-plugins</a></p> <ul> <li>Android <ul> <li>GoogleAnalyticsTracker.java</li> <li>analytics.js</li> </ul></li> <li>iOS <ul> <li>GoogleAnalyticsPlugin.h / GoogleAnalyticsPlugin.m</li> <li>GoogleAnalyticsPlugin.js</li> </ul></li> </ul></li> <li><p><strong>Google Analytics</strong> from <a href="http://code.google.com/mobile/analytics/docs/" rel="noreferrer">Google</a></p> <ul> <li>Android <ul> <li>libGoogleAnalytics.jar (no source available)</li> </ul></li> <li>iOS - <em>these are included with the phonegap plugin for convenience</em> <ul> <li>libGoogleAnalytics.a (no source available)</li> <li>GANTracker.h</li> </ul></li> </ul></li> <li><p><strong>PhoneGap</strong> from <a href="http://phonegap.com/" rel="noreferrer">PhoneGap</a></p> <ul> <li>Android <ul> <li>add <code>&lt;plugin name="GoogleAnalyticsTracker" value="com.package.path.to.class.GoogleAnalyticsTracker"/&gt;</code> to res/xml/plugins.xml file</li> </ul></li> <li>iOS <ul> <li>In “Supporting Files/PhoneGap.plist” file add: </li> <li>Plugins: <ul> <li>key = googleAnalytics (name used in the javascript) Value = GoogleAnalytics (name of Obj-C object)</li> </ul></li> <li>External Hosts <ul> <li>‘*’ (without quotes) as Item 0</li> </ul></li> </ul></li> </ul></li> </ol> <p>NB: Remember that even though the iOS and Android versions have a <code>phonegap-1.2.0.js</code> file they are <strong>NOT</strong> the same file. The code is different and you can't just copy it between platforms. Make sure your app uses the appropriate version.</p> <hr> <p><strong>Android Javascript</strong></p> <pre><code>window.plugins.googleAnalytics.start ("your UA code", //UA-account ID function() { console.log("started") }, //successCallBack function() { console.log("didn't start") } //failureCallBack ); window.plugins.googleAnalytics.trackPageView ( //**NB**: NOTE CAPITAL 'V' "/Main Page", //Page (include /) function() {console.log("tracked page view")}, //successCallBack function() {console.log("didn't track page view")} //failureCallBack ); window.plugins.googleAnalytics.trackEvent ( "Contact", //Category "Email", //Action “John Smith”, //Label 0, //Value function() { console.log("tracked event") }, //successCallBack function() { console.log("didn't track event") } //failureCallBack ); </code></pre> <hr> <p><strong>iOS Javascript</strong></p> <pre><code>window.plugins.googleAnalyticsPlugin.startTrackerWithAccountID(“your UA code”); window.plugins.googleAnalyticsPlugin.trackPageview(whichPage); //Note lowercase v in trackPageview. window.plugins.googleAnalyticsPlugin. googleAnalytics.trackEvent( "Contact", "Email", “John Smith” 0, function() { console.log("tracked event") }, //successCallBack function() { console.log("didn't track event") } //failureCallBack ); </code></pre> <p><strong>NB</strong>. the variable ‘whichpage’ MUST be preceded with a forwardslash (/). Android will let you away without this. iOS will NOT.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload