Extension for Google Anaytics

F Fernando Coelho da Silva 2 years 11 months ago
0 1 0

Someone already wrote some native extension for iOS and Android for Google Anaytics that you can share?
Using the following parameters takes too long to load on application startup:  var _gaq = _gaq | | [];        _gaq.push (['_setDomainName', 'none']);        _gaq.push (['_setAccount', 'UA-xxxxxx-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);        }) ();

Please register or login to post a reply

1 Replies

J Jon Tara

There's no possibility of an extension, and it wouldn't help even if there was.

Google Analytics uses a Javascript API. They don't provide any alternative API that native code would be able to use. Their Terms and Conditions require that you load their Javascript from from their server for every session. You are not allowed to store a local copy of the Javascript, and that would be difficult in any case, because of Google's dynamic Javascript loader.

The delay you see if almost certainly due to having to load the script from the Google server.

You will have to somehow deal with the possibility that the device is off-line and has no Internet access. If your app hangs in this situation, Apple will reject it from the App Store.

You need to carefully think-out your use of online APIs like Google Analytics, Google Maps, etc. and make sure that they don't interfere with offline use.

You're creating a native app, not a website!

You might want to research other analytic services that are more well-suited for use with mobile apps.

CONTACT
Can’t find what you’re looking for?