Could you please explain to me the correct approach to including Google mobile analytics into applications. Is there a way to include the google sdks for both IOS and Android?
Could you please explain to me the correct approach to including Google mobile analytics into applications. Is there a way to include the google sdks for both IOS and Android?
Hello! Please take a look here https://getsatisfaction.com/apperyio/...
We'll add google mobile analytics script for all platforms after the next release.
Unfortunately that post is not very helpful to me. Could you please explain how I would include the standard ga script to use conventional analytics until the next release?
Hi Nathan.
There is a simple solution:
ol
liCreate_new - JavaScript;/li
liCall this JavaScript something like "googleAnalytic";/li
liInsert this code into it:/li
pre
var _gaq = _gaq || [];
gaq.push(['setAccount', 'UA-xxxxxxxx-x']);
gaq.push(['trackPageview']);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
/pre
/ol
And that's all.
Note: To check if Google Analytic was loaded and started successfully you can do following:
ol
liOpen debug browser console and type "_gaq". Run it. If you see "undefined" as a result - Google Analytic is not loaded, and successfully loaded in other case./li
liTo test GA use next code:/li
pre
gaq.push(['trackEvent', 'name', "val_"]);
/pre
/ol
-- after this code you should see in the "net" tab request to the Google with current event.
In fact Appery.io application is a single page application. GA tracking the page when loaded and runs GA code. That's why you can't see other pages in the GA admin console.
But there is two things that can help you to track pages and events:
ol
li _trackPageview/li
-- tracks pages when you need.
li_trackEvent/li
--tracks events that you need (like the user is choosing the select).
Please read the following source: https://developers.google.com/analyti...
If you need only the page tracking. You could try next code:
pre
var _gaq = _gaq || [];
gaq.push(['setAccount', 'UA-17912306-1']);
gaq.push(['trackPageview']);
//Add event handler on page show.
var onPageShow = function(){
//Track page into GA when it has been shown
gaq.push(['trackPageview', window.location.href]);
};
jQuery(document).bind("pageshow", onPageShow);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
/pre/ol
In fact Appery.io application is a single page application. GA tracking the page when loaded and runs GA code. That's why you can't see other pages in the GA admin console.
But there is two things that can help you to track pages and events:
ol
li _trackPageview/li
-- tracks pages when you need.
li_trackEvent/li
--tracks events that you need (like the user is choosing the select).
Please read the following source: https://developers.google.com/analyti...
If you need only the page tracking. You could try next code:
pre
var _gaq = _gaq || [];
gaq.push(['setAccount', 'UA-17912306-1']);
gaq.push(['trackPageview']);
//Add event handler on page show.
var onPageShow = function(){
//Track page into GA when it has been shown
gaq.push(['trackPageview', window.location.href]);
};
jQuery(document).bind("pageshow", onPageShow);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
/pre/ol