Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]

Release: Google Analytics module
Started by jonjonsson Aug 24 2014 12:14 AM

* * * * * 1 votes
No replies to this topic
google analytics analytics
[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Pro
  • PipPipPipPipPipPip
  • 947 posts
  • Jedi

I made a module for Google Analytics Mobile App Tracking that I thought I would share. Some of the things you can track with this module: events, scenes, sessions, purchases, timings, social events and errors. It also has some basic offline support.

I have not tested this thing to the max on many devices, please report any issues and any improvement ideas you may have.

Its not using the native SDKs of iOS and Android but instead sends the payloads to Google via POST. From what I can tell there is not much downside to this, but then again I have never tried the native method.


There was one hurdle that makes this a little hacky. The network.request() function on iOS does not send a user agent that Google can determine the device type from (discussed here). To overcome this the module will create a webview on iOS devices (off screen when launched) and use a local html file with some javascript to get the correct user agent and then resend any events it may have missed during that process. 


Code share: http://code.coronalabs.com/code/google-analytics-module

Repo: https://bitbucket.org/Jonjonsson/google-analytics-for-corona-sdk/


Also tagged with one or more of these keywords: google analytics, analytics